Logo
Valid Email Check
Online Now: 0
Snippet Code
This will check an email, to see if it is in a valid format.

chkEmail.php


<?php
if(isset($_POST['email'])){
    
$email $_POST['email'];
    if(
filter_var($emailFILTER_VALIDATE_EMAIL)){
        echo 
'<p>This is a valid email.<p>';
    }else{
        echo 
'<p>This is an invalid email.</p>';
    }
}
?>
<form action="" method="post">
    Email: <input type="text" name="email" value="<?php echo $_POST['email']; ?>">
    <input type="submit" value="Check Email">
</form>
 
Snippet Comments

Add Your Comment

holidays Disney World
2011-06-26 10:03:25
Wow Its really amazing thing to learn about it and I did feel like using it. Thanks for your share.
orlando networks
2011-06-21 18:47:45
The code works so good for this. There is so much that you can get from validating your email.
mobile casino
2011-05-18 03:22:53
The PHP makes it easy for anyone to learn. It is significantly easier than comparable Perl or ASP CodeThanks for sharing the informative post. Regards. Roy.
php scripts
2010-09-14 00:25:04
I hate spam. thx for you email check script.
Anonymous
2010-08-27 06:39:18
Guys this just validates structure of the email address not that it works, this is good practise.
CasTex
2009-11-23 00:00:00
This will only check if this is an email.
Anonymous
2009-10-15 00:00:00
xyz@abc.museum is a valid e-Mail address not matched by this regex. {2,6} should do the trick.
Matthew
2008-08-21 00:00:00
You cannot verify an email address using a regular expression. It's OK to use a script like this to warn a user that they may have entered their email address incorrectly.

The only practical way to verify an email address is too send them an actual email.

Add Your Comment

 
Snippet Tools
Rate this Snippet:

Rate the difficulty level:

Request Snippet Update


Suggested Difficulty Level: Intermediate
Current Score: 2.74
Total votes: 257
Total Views: 8899

Other top snippets by admin:

1. JPEG to ASCII Converter
2. Add (th, st, nd, rd, th) to the end of a number
3. Dynamic Page Content From Links
4. AJAX Quickie
5. Simple Image CAPTCHA

Search
Search for:







User Panel

User name:

Password:

Register And Post Your Own Snippets

New Snippets

1.  Shorten text and (4 of 1)

2.  file-based simple guest (0 of 0)

3.  adding an entry (0 of 0)

4.  integer to currency (1.33 of 3)

5.  Aggregate IP addresses (0 of 0)

6.  file handling (0 of 0)

7.  testing system with (0 of 0)

8.  Make an php (1 of 1)

9.  allow download in (5 of 1)

10.  redirect in 3 (0 of 0)

11.  live clock with (0 of 0)

12.  visit counter (3.5 of 2)

13.  contact form with (4 of 1)

14.  show a specific (0 of 0)

15.  The & sign (0 of 0)

16.  static variable in (0 of 0)

17.  multiplication table with (0 of 0)

18.  function with multiplicationt (0 of 0)

19.  php generated menu (0 of 0)

20.  drawing a table (0 of 0)

21.  embedded array (one (0 of 0)

22.  checks the week (0 of 0)

23.  put links on (4.5 of 2)

24.  Directory Image Gallery (0 of 0)

25.  TOS (4 of 1)

Home | Forum | Free PHP Web Hosting | Contact | Terms & Conditions |  
Donate
PHPSnips.com - ©2012 Amethyst Creative