Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Email Validation

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 965
    Comment on it

    Hello Reader's today we will discuss about "Email validation in Php". The below code tells that how to check your email is valid or not. For this we use regular expression for validate email.

    <?php
    if(isset($_POST['submit']))
    {
      $email_from = $_POST['email'];
      $email_exp = '/^[A-Za-z0-9._%-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/';
        if(preg_match($email_exp,$email_from)) {
          echo 'The Email Address you entered does not appear to be valid.';
        }
        else
        {
          echo $error_message .= 'The Email Address you entered does not appear to be invalid.';
        }
      }
    ?>
    <form method="post">
      <div>
        <input type="text" name="email" id="email" value="" />
      </div>
      <div>
        <input type="submit" name="submit" id="submit" value="Submit" />
      </div>
    </form>
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: