PHP email validation question?
Posted
by GeNx
on Stack Overflow
See other posts from Stack Overflow
or by GeNx
Published on 2010-03-25T10:50:47Z
Indexed on
2010/03/25
10:53 UTC
Read the original article
Hit count: 442
Will this email validation allow foreign email address like russian, hebrew and so on? And how can I just check for the @ sign?
Here is the php code.
if (preg_match ('/^[\w.-]+@[\w.-]+\.[A-Za-z]{2,6}$/', $_POST['email'])) {
$email = mysqli_real_escape_string($mysqli, strip_tags($_POST['email']));
} else {
echo '<p class="error">Please enter a valid email address!</p>';
}
© Stack Overflow or respective owner