This is my code.
function emailField($email)
{
return filter_var($email, FILTER_VALIDATE_EMAIL);
}
and
if(emailField($_POST['email'])=='')
{
echo "Invalid email";
}
else
{
echo "Valid";
}
This allows all the special characters. I want to allow underscore, hyphen and dot only. How to avoid?