How Can I Make an Email Validation Function work with EXTR_PREFIX_SAME?
<p>How Can I Make an Email Validation Function work with EXTR_PREFIX_SAME? Any advice would be greatly appreciated. Thank you.</p>

<p>Here is the PHP File</p>

<pre><code>&lt;?php
    extract($_POST, EXTR_PREFIX_SAME, "post");

    // Make variable names correspond to form element names with extract and EXTR_PREFIX_SAME

    // response
    echo "&lt;h1&gt;Thank you for your interest.&lt;/h1&gt;";
    echo "&lt;div&gt;Here is a copy of the information you provided:&lt;br/&gt;&lt;br/&gt;";
    echo "Where did you hear about us: ".$where_hear."&lt;br/&gt;";

    // text area
    echo "Name: ".$name."&lt;br/&gt;";
    echo "Email: ".$email."&lt;br/&gt;";

    // email validation function
    function valid_email($email) {
         $good_email = "/^([a-z0-9_.-]+)@([da-z.-]+).([a-z.]{2,6})$/ ";
       if (preg_match($good_email, $email)) {
     echo $email . " is a valid email address.&lt;br&gt;";
     return true;
     }
     else {
     echo $email . " is NOT a valid email address.&lt;br&gt;";
     return false;
     }
    }
    //email validation function end

    ?&gt;
</code></pre>
