I added validation on email input, but it is not working, why?
the error is that when I give input as example@yah.oo.com
; not showing any error messages, why?
my code is
else if(!filter_var($email,FILTER_VALIDATE_EMAIL))
{
echo "email is not valid";
return false;
}
I also used preg_match
function but the same problem occurs, can any one tell me why it is not showing any validation message.
As of my knowledge, that an email address only contains one dot(.) is it
The validation is correct - your understanding is wrong. An email address of joe.soap@example.co.uk
(two dots) is valid, as is joe.soap@email.example.co.uk
(three dots), etc.
The only reliable way to validate an email address is to send a message to it.
You can make one yourself like the one below;
function checkEmail($email){
return eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email);
}