Hi ;D! I was working on a contact page and I would like to add a feature in which it redirects the user back to the form for an incorrect E-Mail format. I already have this code, but it comes up with an error similar to this:
Warning: preg_match() [function.preg-match]: No ending delimiter '^' found in C:\xampp\htdocs\contactsend.php on line 23
Warning: Cannot modify header information - headers already sent by (output started at C:\xampp\contactsend.php:23) in C:\xampp\contactsend.php on line 24
This is my code:
[php]
$email = trim($_REQUEST[‘email’]);
$pattern = “^(0-9a-zA-Z@([0-9a-zA-Z][-\w][0-9a-zA-Z].)+[a-zA-Z]{2,9})$”;
if (preg_match($pattern, $email) === false){
header( ‘Location: contact.php?redirect=3’);
exit;
}
[/php]
I would like to know what was wrong with my code and how I could fix it, thanks!