メール検証関数を EXTR_PREFIX_SAME で動作させるにはどうすればよいですか? アドバイスをいただければ幸いです。ありがとうございました。
ここにPHPファイルがあります
<?php
extract($_POST, EXTR_PREFIX_SAME, "post");
// Make variable names correspond to form element names with extract and EXTR_PREFIX_SAME
// response
echo "<h1>Thank you for your interest.</h1>";
echo "<div>Here is a copy of the information you provided:<br/><br/>";
echo "Where did you hear about us: ".$where_hear."<br/>";
// text area
echo "Name: ".$name."<br/>";
echo "Email: ".$email."<br/>";
// 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.<br>";
return true;
}
else {
echo $email . " is NOT a valid email address.<br>";
return false;
}
}
//email validation function end
?>