E-Mail Validation Using PHP


 E-Mail  VALIDATION

/*email.html*/

<head>
<body>
<title>Email Validation</title>
</head> </body>
<form action ="action.php" method="post" name=one>
<h2> <center>WELCOME TO THE E-Mail Validation</center></h2>
<table>
<tr>
            <td>Enter the E-mail:</td>
            <td><input type="text" name="val" size="30" /></td>
</tr>
</table>
<input type="submit" value ="Check"/>
<input type="reset" value ="CLEAR"/>
</form>

/*action.php*/

<?php
$string = $_POST['val'];
if (eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $string)) {
    echo "<b>".$string."</b>"."  is Valid";
}
else
            echo "<b>".$string."</b>"."  is Not Valid";
?>

0 comments: