Email validation with Regular Expressions : Email Validation : Email PHP Source Code


PHP Source Code » Email » Email Validation »

 

Email validation with Regular Expressions



<html>
<head><title></title></head>
<body>
<?php

if (isset($_POST['posted'])) {

   $email = $_POST['email'];
   $theresults = ereg("^[^@ ]+@[^@ ]+.[^@ .]+$", $email, $trashed);
   if ($theresults) {
      $isamatch = "Valid";
   else {
      $isamatch = "Invalid";
   }

   echo "Email address validation says $email is " . $isamatch;
}

?>

<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="POST">
<input type="hidden" name="posted" value="true">
Enter your email address for validation:
<input type="text" name="email" value="name@example.com">
<input type="submit" value="Validate">
</form>
</body>
</html>

           
       



HTML code for linking to this page:

Follow Navioo On Twitter

PHP Source Code

 Navioo Email
» Email Validation