The preg_match that I added validates that $email is in a valid email format, it is not a replacement for the original.
The original preg_match is there to reduce the risk of email injection, if this is not a term you know than look it up with your search engine.
This is what the validation should look like in your PHP:
PHP Code:
$email=trim($_POST['email']);
if (preg_match(' /[\r\n,;\'"]/ ', $email)) {
exit('Invalid Email Address');
} else if (!preg_match('/\b[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\b/im', $email)) {
exit(' Valid Email address format required');
} else {
mail($to,$subject,$message,$headers);
mail($to2,$subject,$message2,$headers);
header("Location: http://www.lotatennis.com");
}
There is no need to do the empty() test, an empty value in $email will not pass the email format test.
Sorry about the problem with the ', this code should now have the correct number of them
Bookmarks