Hi
The following script was taken from John Coggeshall's (PHP consultant) in his
article on Zends site at http://www.zend.com/zend/spotlight/ev12apr.php
// Get the email address to validate
$email = $_POST['email']
// Use John Coggeshalls script to validate the email address
if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-
]+)*(\.[a-z]{2,3})$", $email) {
echo "The e-mail was not valid";
}
else {
echo "The e-mail was valid";
}
In the first instance the script does not work if I copy and paste it into my
php file. I get a parse error message.
In the second instance, there are many postings relating to the scripts
effectiveness in that it will still allow email addresses that are invalid.
So I have 3 questions.
1) Why do I get the parse error message?
2) Is there a definitive email validation script?
3) Where can I find regular expressions or other form validation scripts to
validate things such as telephone numbers, postcodes, names that don't contain
numeric characters etc etc
Kind regards
Dynamo
The following script was taken from John Coggeshall's (PHP consultant) in his
article on Zends site at http://www.zend.com/zend/spotlight/ev12apr.php
// Get the email address to validate
$email = $_POST['email']
// Use John Coggeshalls script to validate the email address
if(!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-
]+)*(\.[a-z]{2,3})$", $email) {
echo "The e-mail was not valid";
}
else {
echo "The e-mail was valid";
}
In the first instance the script does not work if I copy and paste it into my
php file. I get a parse error message.
In the second instance, there are many postings relating to the scripts
effectiveness in that it will still allow email addresses that are invalid.
So I have 3 questions.
1) Why do I get the parse error message?
2) Is there a definitive email validation script?
3) Where can I find regular expressions or other form validation scripts to
validate things such as telephone numbers, postcodes, names that don't contain
numeric characters etc etc
Kind regards
Dynamo
Comment