hi,
i have two field, which i need to vaildate, the first field validates fine,
but im having problems with the email field, if i enter the email address on its own, it will vaildate fine, but if i say enter the name and email and submit the vaildation for the email field is missed.
the code is as follows:
echo "I'm sorry, you did not fill out all the required
information\n<br>\n<br>\n";
if($author == "")
{
echo "Name is a required field!\n<br>\n";
}
if($email == "")
{
echo "Email is a required field!\n<br>\n";
}
if(!empty($email)){
if (!preg_match(
'/^[A-Za-z0-9._-]+[@][A-Za-z0-9_-]+([.][A-Za-z0-9_-]+)+[A-Za-z]$/', $email))
{
echo "Email address is not valid!\n<br>\n";
}
}
thanks in advance, if anyone can see where im going wrong...