Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Senior Coder
    Join Date
    May 2006
    Posts
    1,673
    Thanks
    28
    Thanked 4 Times in 4 Posts

    Checking for real email address input.

    Hi,

    I have the following regex to check if the email is entered correctly
    but I think that it should be checking that it ends in .com or .org or .net
    or .co.uk or at least .xx ?

    From what I can work out this isn't checking that ?

    PHP Code:
    // Test for valid email address.
    if ( !ereg"^.+@.+\\..+$",$N_email) ){
             
    $message1 "Please enter your correct email address.";
             require_once (
    "index1_fm.php");
           exit();
             }  
    // endif 
    Would appreciate some help in tightening up this input check.
    Thanks

  • #2
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,855
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Blog Entries
    1
    Have you googled for php+form+validation ?
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #3
    Senior Coder
    Join Date
    May 2006
    Posts
    1,673
    Thanks
    28
    Thanked 4 Times in 4 Posts
    Yep

    I now have this one:

    PHP Code:
    eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$"$email
    Would you say it is a better one ?

    On the same subject, once I am happy that it is a valid
    format, is there a way to find out if it is an existing email account
    rather than a made-up one ?

    ( I mean without using the confirmation link method )

    Thanks


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •