Home Ask Login Register

Developers Planet

Your answer is one click away!

Anks February 2016

Email Validation on user registration form

My code is not running properly. What am I doing wrong? Please suggest. Here is the code:

 elseif(!preg_match("/^[_\.0-9a-zA-Z-]+@([0-9a-zA-Z][0-9a-zA-Z-]+\.)+[a-zA-Z]{2,6}$/i", $email))  
 {   $errorMsg= "error: You did not enter a valid email.";   $code= "3";   }


Pramod Sivadas February 2016

Please use data validation filters available in PHP.



if (filter_var($email, FILTER_VALIDATE_EMAIL) === false) {
  echo("please enter a valid email address");

Post Status

Asked in February 2016
Viewed 2,203 times
Voted 10
Answered 1 times


Leave an answer

Quote of the day: live life