Page 1 of 1

email validation

Posted: Mon Apr 19, 2004 8:19 am
by tiresome

Code: Select all

<?php

if ( !checkString( $email) || !eregi( "^[A-Za-z0-9\_-]+@[A-Za-z0-9\_-]+.[A-Za-z0-9\_-]+.*", $email)) {
    echo "You have entered an <b>invalid email</b>.<br> Please go back and try again.";
    exit;
  }

?>
The above code works to some extent. If the user does not input an '@' then the above error message is displayed but the 'dot' part after that does not work. I want the user to input an email address in the form xxx@xxx.com and I think I have written eregi part in that format.

I have no idea why the '@' sign works while the 'dot' after that doesn't! Any suggestions as to why this might be the case? Any help would be greatly appreaciated

Posted: Mon Apr 19, 2004 8:23 am
by feyd
answer in your other thread.