Woodburn2006 Posted September 15, 2006 Share Posted September 15, 2006 im trying to use this code to validate an e-mail address but everything i try comes out as valid, even if it is blatently not valid:[code]<?phpfunction checkEmail($email) { if(eregi("^[a-zA-Z0-9_]+@[a-zA-Z0-9\-]+\.[a-zA-Z0-9\-\.]+$]", $email)) { return FALSE; }else{ return TRUE; }}if (isset($_POST['submit'])) { $email = trim(strip_tags($_POST['email_address'])); if(checkEmail($email) == FALSE) { echo "E-mail entered is not valid."; } else { echo "E-mail entered is valid."; }} else {?><form method="post" action="<? $_SERVER['PHP_SELF']; ?>">Email<input type="text" name="email_address" size="30"/><input type="submit" name="submit" value="Register"></form><?php}?>[/code]any ideas why it is doing this? Quote Link to comment Share on other sites More sharing options...
michaellunsford Posted September 15, 2006 Share Posted September 15, 2006 here's the code from andy b's captcha script... works for me:[code=php:0]if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email))...[/code] Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.