![]() |
| ||
| preg match Hello all, I am having a hard time trying to figure out why I can't get my code to successfully check my email address. It seems I can plug in anything and it won't give me an error. This is my code for that line: <?php When I type in just letters and don't include @ it accepts it and moves me right along. It's supposed to stop me and tell me to enter a valid email address. Hmmmm... Any help will be appreciated :) ~Amy |
| ||
| Re: preg match why are comparing the preg_match to "<50". preg_match returns true or false. it will return a matches array that you can get the count of if you are trying to make sure there are not over 50 email addresses in the field, which is probably not what you are trying to do. just remove that and it should work. i didn't check out the rest of the code though, so I can't tell for sure. |
| ||
| Re: preg match Hi... Why are u comparing this value with 50.... preg_match returns true of false... If you are comparing with the strlength, then use different if for comparing the string length.. use the following if condition.. this will run... if( !empty($_POST['email']) && preg_match('/^[\w.-]+@[\w.-]+\.[A-Za-z]{2,6}$/', $_POST['email']) ) |
| ||
| Re: preg match Oh, I see. I was trying to control how many characters were entered in the box. Silly me. Thanks everyone! It works now! ~Amy |
| All times are GMT -4. The time now is 10:18 am. |
Forum system based on vBulletin Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
©2003 - 2009 DaniWeb® LLC