Jump to content

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
Link to comment
https://forums.phpfreaks.com/topic/15824-form-submittion/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.