Answer the question
In order to leave comments, you need to log in
How to validate fields with e-mail and phone in php?
What regular expression should be used and how to do it in PHP to check the correctness of e-mail and phone?
if $mail != $regexp?
Mail must be determined by the presence of a dog and a point.
phone by the presence of numbers and specials. characters (brackets, dashes and spaces are allowed, letters are not allowed)
Help, please, the site must be handed over in the morning, I did not sleep all night, now there is no time to learn.
I didn’t find anything good in Google, but maybe it’s just sleepy.
Answer the question
In order to leave comments, you need to log in
Email verification:
if (preg_match('/[^(\w)|(\@)|(\.)|(\-)]/', $email))
...
if (preg_match('/((8|\+7)-?)?\(?\d{3,5}\)?-?\d{1}-?\d{1}-?\d{1}-?\d{1}-?\d{1}((-?\d{1})?-?\d{1})?/', $phone))
...
if(!filter_var($_POST['email'], FILTER_VALIDATE_EMAIL))
die("Incorrect email!");
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question