Here is my code:
$contact_email = strtolower($_POST[contact_email]);
if ($contact_email == "")
{
$msg .= "<strong>Enter your email!<br></strong>";
}
elseif ($contact_email > "")
{
$int = (ereg("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $contact_email));
if ($int == 0)
{
$msg .= "<br><strong></strong><strong>Invalid Email! Please include a @ and use a .com, .org or .Country(ie .au, .tr) type address</strong><br>";
}
}
I am using this code in two different pages (I know I should have a function that I call). When a user types his address in upper case I change it to lower. One page it works fine and I get no errors. The other page does not like it at all and returns the error after validating.
Thanks