Forum Moderators: coopster
Heres the line that checks the field contents for the correct characters and format. But it always says the email is not valid. Strange thing is, it worked the other night when i first uploaded it. Went to add a captcha system to the form..but found out the email didn't work..even with no captcha in as before.
if(!preg_match('/^([a-zA-Z0-9\-\_\.]+\@[a-zA-Z0-9\-\_\.]+\.[a-zA-Z0-9\-\_])$/',$_POST['email'])){
Is there a mistake in this line somewhere? I use dreamweaver code view with highlighting, and the code colours look normal and not all one colour like you get when you leave a " or ' open or something..
:)
Does this tie in with your scripted logic? i.e., is that if statement catching valid or invalid email addresses? It could be as simple as removing the ^ from the pattern, or removing the! from the if condition.
I then tried this line, a more basic approach
if(!preg_match('/^([a-zA-Z0-9\s]{3,50})$/',$_POST['email'])){
And it worked fine (except without the @ or dots). Just a random bunch of letters.
But i cant see anything wrong with the first line in the first post that can possibly be causing it to stop any email typed into the form...