[thelist] PHP Form Validation

Andrew Maynes andrew at humanbehaviour.co.uk
Mon Jan 6 10:13:01 CST 2003


Hi All

I have been creating a contact form and tell a friend form and need a view
pointers.  The tell a friend form needs to validate two email addresses, the
sender's and the sender's friend.  At the moment I only have this: which only
checks one of the emails ($email) I need to check the $receiver3 =
"<$friends_email>"; also but the code below doesn't like it when I add
friends_email

/*e-mail´s validity is check with this */
if (!eregi ("^[_\\.0-9a-z-]+@([0-9a-z][0-9a-z-]+\\.)+[a-z]{2,4}$", $email))
$error_message = "A valid e-mail address is required.";

Another part of this problem is (which is prossibly part of the answer) the same
error message will apply to both missing fields and I reaaly want two different
messages.

Thank  you
Andrew




More information about the thelist mailing list