How do I validate my email submission on php? <p>I'm just getting into coding and put together a webpage using dreamweaver. I created a php page with my email coding which is executed from a form and submit button on an html page. I continously recieve blank emails on a daily basis which apparently means I need to add validation coding. I tried adding the coding but the problem persists. The page still submits even if the form is blank.</p> <p>Below is my current coding.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true"> <div class="snippet-code"> <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php if(!filter_var($_POST['CustomerEmail'], FILTER_VALIDATE_EMAIL)) { $valerrors[] = "The email address you supplied is invalid." ;} $customeremail=$_POST['CustomerEmail']; $email='test@gmail.com'; $custfirst=$_POST['CustomerFirstName']; $custlast=$_POST['CustomerLastName']; $custphone=$_POST['CustomerNumber']; $custaddress=$_POST['CustomerAddress']; $custcity=$_POST['CustomerCity']; $custstate=$_POST['CustomerState']; $custrequest=$_POST['CustomerService']; $subject='Service Request'; $body = &lt;&lt;&lt;EOD &lt;br&gt;&lt;hr&gt;&lt;br&gt; Email: $customeremail &lt;br&gt; First Name: $custfirst &lt;br&gt; Last Name: $custlast &lt;br&gt; Phone: $custphone &lt;br&gt; Address: $custaddress &lt;br&gt; City: $custcity &lt;br&gt; State: $custstate &lt;br&gt; Request: $custrequest &lt;br&gt; EOD; $headers = "From: $customeremail\r\n"; $headers .= "Content-type: text/html\r\n"; $Send = mail($email, $subject, $body, $headers); $confirmation = &lt;&lt;&lt;EOD &lt;html&gt;"Thanks for Submitting."&lt;/html&gt; EOD; echo"$confirmation"; ?&gt;</code></pre> </div> </div> </p> <p>It's possible that I'm placing the if statement in the wrong place. Can someone correct my coding so the confirmation page will not load and the email will not be sent if the customer email is left blank?</p>