Jump to content


Form Submittion...

  • Please log in to reply
1 reply to this topic

#1 oMIKEo

  • Members
  • PipPip
  • Member
  • 19 posts
  • LocationLeeds, UK

Posted 27 July 2006 - 07:05 PM


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:
if($_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';


	header("Location:register1.php"); exit();	

This code is at the top of register.php and the form looks like:

<form action="register.php" method="post" enctype="application/x-www-form-urlencoded" name="form2">

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,

#2 thepip3r

  • Members
  • PipPipPip
  • Advanced Member
  • 289 posts

Posted 27 July 2006 - 07:15 PM

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.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users