<?php
if (empty($_POST['YOURMAIL'])) {
$msg_warning .= "Email field is required";
}
if (!empty($_POST['YOURMAIL'])) {
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*"."@([a-z0-9]+([\.-][a-z0-9]{1,})+)*$",$_POST[YOURMAIL])){
$msg_warning .= "Email is invalid.</li>";
}
}
?>
กับ Code (PHP)
<?php
if (empty($_POST['YOURMAIL'])) {
$msg_warning .= "Email field is required";
} else if (!empty($_POST['YOURMAIL'])) {
if(!eregi("^[a-z0-9]+([_\\.-][a-z0-9]+)*"."@([a-z0-9]+([\.-][a-z0-9]{1,})+)*$",$_POST[YOURMAIL])){
$msg_warning .= "Email is invalid.</li>";
}
}
?>