Jump to content

Archived

This topic is now archived and is closed to further replies.

oMIKEo

Form Submittion...

Recommended Posts

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]<?php
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';

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.