marksie1988 Posted June 29, 2007 Share Posted June 29, 2007 Hi, i have created a registration script for my website and i have added a new featurer that makes you enter your email address twice and then it is supposed to check if they are the same and then if they are submit the form but if not show an error but even if the email addresses are the same it still shows the error below is the code for the email checking /* Email error checking */ $field = "email"; //Use field name for email $field2 = "email2";// Second field for email if(!$subemail || strlen($subemail = trim($subemail)) == 0){ $form->setError($field, "* Email not entered"); elseif(!$subemail2 || strlen($subemail2 = trim($subemail2)) == 0){ $form->setError($field, "* Confirm Email not entered"); } else{ /* Check if valid email address */ $regex = "^[_+a-z0-9-]+(\.[_+a-z0-9-]+)*" ."@[a-z0-9-]+(\.[a-z0-9-]{1,})*" ."\.([a-z]{2,}){1}$"; if(!eregi($regex,$subemail)){ $form->setError($field, "* Email invalid"); } else if ($subemail !== $subemail2){ $form->setError($field2, "* Emails does not match"); } $subemail = stripslashes($subemail); } Cheers Quote Link to comment Share on other sites More sharing options...
bwcc Posted June 29, 2007 Share Posted June 29, 2007 Just looking at your script, $subemail and $subemail2 haven't been declared before your if statements. Quote Link to comment Share on other sites More sharing options...
marksie1988 Posted July 1, 2007 Author Share Posted July 1, 2007 oops sorry they are declaired further up in the script but i have had to remove this feature as i need the script to work now but i am going to setup a test bed and try it again another time 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.