bri4n Posted April 27, 2007 Share Posted April 27, 2007 Hi everybody! I would really appreciate some help in resolving this probelm. I have a form that should return "Thanks for Registering!" once the user hits the register button. You can see how it all works here: http://www.god-zone.org.nz/artzy/register.php However what is happening is that the registration form keeps getting returned. I'ld appreciate it if you could look at the following code and see what I've done wrong: /*Check for errors in form fields*/ $message=""; foreach($_POST as $field => $value) { if (ereg("(fname)", $field)) { if(!ereg("^[A-Za-z' -]{1,50}$",$value)) { $message .="Please provide your first name.<br/>"; } } if (ereg("(lname)", $field)) { if(!ereg("^[A-Za-z' -]{1,50}$",$value)) { $message .="Please provide your last name.<br/>"; } } if (ereg("(town)", $field)) { if(!ereg("^[A-Za-z' -]{1,50}$",$value)) { $message .="Please provide your town.<br/>"; } } if (ereg("(region)", $field)) { if(!ereg("^[A-Za-z' -]{1,50}$",$value)) { $message .="Please provide your Region or State.<br/>"; } } if (ereg("(country)", $field)) { if(!ereg("^[A-Za-z' -]{1,50}$",$value)) { $message .="Please provide your Country.<br/>"; } } if (ereg("(email)", $field)) { if (!ereg("^.+@.+\\..+$",$email)) { $message .="Please provide a correct email address.<br/>"; } } if (ereg("(login)", $field)) { if(!ereg("^[A-Za-z' -]{1,50}$",$value)) { $message .="Please type in a valid Login Name.<br/>"; } } if (ereg("(pwd)", $field)) { if(!ereg("^[A-Za-z)(0-9]{1,50}$",$value)) { $message .="Please choose a valid password.<br/>"; } } $$field = strip_tags(trim($value)); } //end foreach If($message !=””){ include("register.inc.php"); exit; } /*End of error checking*/ /*Retrieve information from Registration form and insert it into database*/ $sql = "INSERT INTO artist (fname,lname,town,region,country,email,phone, logname.pwd) VALUES ('$fname', '$lname', '$town', '$region','$country','$email','$phone','$login', '$pwd')"; mysql_query($sql); /*Send confirmation of registration*/ echo "Thanks for registering!" /*End confirmation*/ I'm still learning PHP and would appreciate any help! TIA Brian Link to comment https://forums.phpfreaks.com/topic/48881-form-processing-problem/ Share on other sites More sharing options...
neel_basu Posted April 27, 2007 Share Posted April 27, 2007 Please use [ code ] [ /code ] or [ php ] [ /php ] Link to comment https://forums.phpfreaks.com/topic/48881-form-processing-problem/#findComment-239594 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.