I'm working on a script that will validate a form, and the only thing I'm stuck on is the e-mail address... I found several different regexp patterns out there for matching e-mail addresses, but either they don't work (less likely) or my script is wrong (more likely). Can anyone help me out? Here's my function:
function check_email($email) {
global $errors;
$pattern = "^(0-9a-z]+)([0-9a-z\.-_]+)@([0-9a-z\.-_]+)\.([0-9a-z]+)$";
if ($email == "") {
print "<b><font color=red>E-mail Address may not be blank.</font></b><br>\n";
$errors = "Y";
return false;
} else if (!eregi($pattern,$value)) {
print "<b><font color=red>E-mail Address is invalid.</font></b><br>\n";
$errors = "Y";
return false;
} else {
return true;
}
}
And here's the form page:
http://www.hoopscitylive.com/v2.0/signup.php
Any help would be appreciated. Thanks!
Regards,
Mike Aparicio