Email validation Demo : Email Validation « Email « PHP

Home
PHP
1.Chart
2.Class
3.Components
4.Cookie Session
5.Data Structure
6.Data Type
7.Date
8.Design Patterns
9.Development
10.DNS
11.Email
12.File Directory
13.Form
14.Functions
15.Graphics Image
16.HTML
17.Language Basics
18.Login Authentication
19.Math
20.MySQL Database
21.Network
22.Operator
23.PDF
24.Reflection
25.Statement
26.String
27.Utility Function
28.Web Services SOAP WSDL
29.XML
PHP » Email » Email Validation 
Email validation Demo

       
<html>
<head>
<title>e-mail validator</title>
</head>
<body>
<form name="form1" method="post" action="EMailValidation.php">
  <table>
      <tr> 
        <td colspan="2"><b>Enter an e-mail address to test</div></td>
      </tr>
      <tr> 
        <td width="25%">E-mail</td>
        <td width="75%"
           <input type="text" name="email" size="30">
        </td>
      </tr>
      <tr> 
        <td colspan="2"
          <input type="submit" name="Submit" value="Submit">
        </td>
      </tr>
 </table>
</form>
</body>
</html>
                           
<!-- EMailValidation.php
<html>
<head>
<title> E-mail validator </title>
</head>
<body>
<?php
                                                
  if (!isset($email)){
    die("Host name value wasn't properly submitted.Retry.");
  }

  if(empty($email)) {
    die("Hostname field was left blank ! Retry.")
  }
                                                      
  if ( (strlen($email3|| (strlen($email200)) {
    die("Invalid E-mail address, E-mail address too long or too short.");
  elseif(!ereg("@",$email)) {
    die("Invalid E-mail address, no @ symbol found");
  else {
    echo "<b>".$email."</b> is correct in format.<br>";
  }
                                                      
  list($username,$hostname= split("@",$email);
                                                      
  if ( (empty($username)) or (empty($hostname)) ) {
    die("username or host name section is not valid.");
  }
                                                      
  if(checkdnsrr($hostname)) {
      echo "<b>". $email ."</b> hostname has a valid MX record !<br>";
  else {
      die("<b>". $email ."</b> hostname does not exist");
  }
?>
<br>
</body>
</html>
-->

           
       
Related examples in the same category
1.Email validation with Regular Expressions
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.