如何使电子邮件验证功能与 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
?>