cooldude832 Posted October 10, 2007 Share Posted October 10, 2007 I'm trying to validate a form and I have this <?php $email = trim($_POST['email']); $name = trim($_POST['name']); if (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $email)){ $error_email == "Invalid Email"; } if(3 > strlen($name)){ $error_name == "Name was empty"; } if(empty($error_name) && empty($error_email)){ $password = gen_string(5); $password_2 = md5($password); //connectSQL(); $q = "Insert into `".F_TABLE."` (email, name) values ('".$email."', '".$name."')"; //$r = mysql_query($q) or die(mysql_error()); //$userID = mysql_insert_id(); $added = 1; } } ?> and for some strange reason I can post the name with a strlen <3 and even echo it out saying the length is and it still validates it. The same with the email (i know the regex pattern is valid, even if it isn't it shouldn't validate on a blank) It is validating blanks, anything everything when that shouldn't be the case I'm really confused here Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted October 10, 2007 Author Share Posted October 10, 2007 go ahead call me an idiot i had == on them I need to slow down my typing Quote Link to comment Share on other sites More sharing options...
pocobueno1388 Posted October 10, 2007 Share Posted October 10, 2007 These lines shouldn't have two equal signs $error_email == "Invalid Email"; $error_name == "Name was empty"; EDIT Hah, yeah, I was just typing that out as you can see above. Did that fix the problem? Nevermind, I see that you pressed solved. Quote Link to comment Share on other sites More sharing options...
cooldude832 Posted October 10, 2007 Author Share Posted October 10, 2007 I'm working on someone else's server so I was so quick to accuse that of my woes, and == looks like a single = in my editor so I didn't think of anything. I spent a good half hour scratching my head 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.