oMIKEo Posted July 27, 2006 Share Posted July 27, 2006 Hi,Ive got all my validation complete but would like to know how to make it so that when i click the submit button it runs through the php validation and then submits the form to register1.php (where the values are stored in the DB and more info is collected?Here is the code:[code]<?phpif($_POST['sent'] == "Y"){ $password = stripslashes($_POST['password']); $band_email = stripslashes($_POST['band_email']); $personal_email = stripslashes($_POST['personal_email']); $act_type = stripslashes($_POST['act_type']); $genre = stripslashes($_POST['genre']); $act_name = stripslashes($_POST['act_name']); $fullname = stripslashes($_POST['fullname']); $mobilenumber = stripslashes($_POST['mobilenumber']); $county = stripslashes( $_POST['county']); $conn=mysql_connect("$db_host","$db_username","$db_password") or die("Err:Conn"); $rs = mysql_select_db("$db_main",$conn) or die("Err:Db"); $sql="select * from bn_profile where band_email = \"$band_email\""; $rs=mysql_query($sql,$conn) or die("Could not execute query: ".mysql_error()); $bandemailnum = mysql_num_rows($rs); if($act_type == "0") $e1 = 'Please select an Act Type'; elseif($genre == "0" && $act_type == "1") $e2 = 'Please select a Genre'; elseif($act_name == "") $e3 = 'Please enter your Act Name'; elseif($fullname == "") $e4 = 'Please enter your Full Name'; elseif($mobilenumber == "") $e5 = 'Please enter your Telephone Number'; elseif (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $personal_email)) $e6 = 'Please enter a valid Email Address'; elseif($county == "0") $e7 = 'Please select a County'; elseif (!eregi("^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$", $band_email)) $e8 = 'This is not a valid Email Address'; elseif ($bandemailnum > 0) $e8 = '<br />This Email Address has already been used.<br />Please enter a new address or have you <a href="password.php">Forgotten your Password</a>'; elseif($_POST['band_email_check'] != $band_email) $e9 = 'Band Email Addresses dont match'; elseif (strlen($password) < 5) $e10 = 'Please ensure your Password is 5 or more characters'; elseif($_POST['password_check'] != $password) $e11 = 'Passwords dont match'; else { //SUBMIT NOW! } header("Location:register1.php"); exit(); }[/code]This code is at the top of register.php and the form looks like:[code]<form action="register.php" method="post" enctype="application/x-www-form-urlencoded" name="form2">...</form>[/code]At the moment when you click submit it goes to the same page, the SENT variable equals Y so it does the validation.Thanks for any help, Mike Quote Link to comment https://forums.phpfreaks.com/topic/15824-form-submittion/ Share on other sites More sharing options...
thepip3r Posted July 27, 2006 Share Posted July 27, 2006 you'd probably have to write your validated variables out to your session array so that you could then access the variables from whatever page you wanted to call next. Quote Link to comment https://forums.phpfreaks.com/topic/15824-form-submittion/#findComment-64776 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.