PHP MSQL FORM Query Won't Connect - php

Hey guys I've been trying to do a code where I submit a form from a PHP Order Page so that it can update the MySQL Database with the required information
I've got the Order PHP Code Here:
<form action="http://zim.cs.uow.edu.au/~ga420/order.php" method="post">
<tr>
<th>Shirts</th>
<th>Quantity</th>
</tr>
<tr>
<td>
<br />
<input type="checkbox" name="items" value="SH01" />
<label for="rd1">Obey T-Shirt: $9.99</label>
</div>
<br />
<input type="checkbox" name="items" value="SH02" />
<label for="rd1">Obey Professor: $9.99</label>
</div>
<br />
<input type="checkbox" name="items" value="SH03" />
<label for="rd1">Hustle T-Shirt: $9.99</label>
</div>
<br />
<input type="checkbox" name="items" value="SH04" />
<label for="rd1">Hip-Hop Support: $9.99</label>
</div>
<br />
<input type="checkbox" name="items" value="SH05" />
<label for="rd1">90's Shirt: $9.99</label>
</div>
<br />
<input type="checkbox" name="items" value="SH06" />
<label for="rd1">DOPE Shirt: $9.99</label>
</div>
<br />
<br />
</td>
<td>
<br />
<input type="text" name="qty" size="2" />
<br/>
<input type="text" name="qty" size="2" />
<br/>
<input type="text" name="qty" size="2" />
<br/>
<input type="text" name="qty" size="2" />
<br/>
<input type="text" name="qty" size="2" />
<br/>
<input type="text" name="qty" size="2" />
<br/>
<br />
</td>
</tr>
<tr>
<td>
<br />
<input type="checkbox" name="items[]" value="SO1" />
<label for="rd1">Shoe - Red Lace: $19.99</label>
</div>
<br />
<input type="checkbox" name="items[]" value="SO2" />
<label for="rd1">Shoe - Red High Top: $19.99</label>
</div>
<br />
<input type="checkbox" name="items[]" value="SO3" />
<label for="rd1">Shoe - White: $19.99</label>
</div>
<br />
<input type="checkbox" name="items[]" value="SO4" />
<label for="rd1">Shoe - Black: $19.99</label>
</div>
<br />
<input type="checkbox" name="items[]" value="SO5" />
<label for="rd1">Shoe - Black High Top: $19.99</label>
</div>
<br />
<input type="checkbox" name="items[]" value="SO6" />
<label for="rd1">Red Basketball: $19.99</label>
</div>
<br />
<br />
</td>
<td>
<br />
<input type="text" name="qty[]" size="2" />
<br/>
<input type="text" name="qty[]" size="2" />
<br/>
<input type="text" name="qty[]" size="2" />
<br/>
<input type="text" name="qty[]" size="2" />
<br/>
<input type="text" name="qty[]" size="2" />
<br/>
<input type="text" name="qty[]" size="2" />
<br/>
<br />
</td>
</tr>
<tr>
<td>
<br />
<input type="checkbox" name="items[]" value="SN1" />
<label for="rd1">Snapback Bullets: $29.99</label>
</div>
<br />
<input type="checkbox" name="items[]" value="SN2" />
<label for="rd1">Snapback: $29.99</label>
</div>
<br />
<input type="checkbox" name="items[]" value="SN3" />
<label for="rd1">Snapback Bullets: $29.99</label>
</div>
<br />
<input type="checkbox" name="items[]" value="SN4" />
<label for="rd1">Snapback Bullets: $29.99</label>
</div>
<br />
<input type="checkbox" name="items[]" value="SN5" />
<label for="rd1">Snapback Bullets: $29.99</label>
</div>
<br />
<input type="checkbox" name="items[]" value="SN6" />
<label for="rd1">Snapback Bullets: $29.99</label>
</div>
<br />
<br />
</td>
<td>
<br />
<input type="text" name="qty[]" size="2" />
<br/>
<input type="text" name="qty[]" size="2" />
<br/>
<input type="text" name="qty[]" size="2" />
<br/>
<input type="text" name="qty[]" size="2" />
<br/>
<input type="text" name="qty[]" size="2" />
<br/>
<input type="text" name="qty[]" size="2" />
<br/>
<br />
</td>
</tr>
</tr>
</table>
<br />
<input type="submit" name="submit">
</form>
<?php
if (isset($_POST['submit'])){
$conn = mysql_connect('url','username','password');
if (!$con){
die("Could Not Connect: " . mysql_error());
}
mysql_select_db("db",$conn);
$sql = "INSERT INTO Order_Information(Order_ID,Order_Items,Order_Quantity) VALUES (null,$_POST[items]','$_POST[qty]')";
mysql_query($sql, $con);
mysql_close($con);
}
?>
Obviously my username and password I won't display but when I hit the submit button it says that it cannot connect.
You can try the form yourself on this website:
http://zim.cs.uow.edu.au/~ga420/order.php
How come it is saying that I can't connect when clearly I have been putting the right details in.
Can anyone help? this has been stressing me out :'(
Your help is appreciated greatly!!

You need to serialize all your inputs/quantities if you will have the same name "qty" in all fields. I will update my answer later if you do t get answer about this.
You had also small bugs on your code, notice this:
VALUES (null,'$_POST[items]','$_POST[qty]')"; - you were missing ' before $_POST[items]
$conn = mysql_connect('zim.cs.uow.edu.au','username','password'); - $conn with 2 "n"
So, a corrected version would be:
<?php
if (isset($_POST['submit'])){
$con = mysql_connect('url','username','password');
if (!$con){
die("Could Not Connect: " . mysql_error());
}
mysql_select_db("db",$con);
$sql = "INSERT INTO Order_Information(Order_ID,Order_Items,Order_Quantity) VALUES (null,'$_POST[items]','$_POST[qty]')";
mysql_query($sql, $con);
mysql_close($con);
}
?>

Change to this. You did some mistake on $conn and $con. Then, '$_POST[items]','$_POST[qty]' in query.
if (isset($_POST['submit'])){
$conn = mysql_connect('url','username','password');
if (!$conn){
die("Could Not Connect: " . mysql_error());
}
mysql_select_db("db",$conn);
$sql = "INSERT INTO Order_Information(Order_ID,Order_Items,Order_Quantity) VALUES (null,'$_POST[items]','$_POST[qty]')";
mysql_query($sql, $conn);
mysql_close($conn);
}
Hope this help

Related

x7 Chat install problems

I am using X7 Chat and trying to install it on my localhost. I got an error on the install.php Here's what I have:
I'm not sure how to fix this. Any help please?
And here's the code on the install.php:
<?php if(empty($fail)): ?>
<form id="dbform">
<?php if(!$config): ?>
<h2>Database Connection Details</h2>
<b><label for="host">Database Host</label></b>
<input type="text" name="host" value="localhost" />
<hr />
<b><label for="user">Database Username</label></b>
<input type="text" name="user" value="" />
<hr />
<b><label for="pass">Database Password</label></b>
<input type="password" name="pass" value="" />
<hr />
<b><label for="dbname">Database Name</label></b>
<input type="text" name="dbname" value="" />
<hr />
<b><label for="prefix">Table Prefix</label></b>
<input type="text" name="prefix" value="x7chat_" />
<hr />
<?php endif; ?>
<h2>Admin Account Details</h2>
<b><label for="admin_username">Admin Username</label></b>
<input type="text" name="admin_username" value="" />
<hr />
<b><label for="admin_username">Admin Password</label></b>
<input type="password" name="admin_password" value="" />
<hr />
<b><label for="retype_admin_password">Retype Admin Password</label></b>
<input type="password" name="retype_admin_password" value="" />
<hr />
<b><label for="admin_email">Admin E-Mail</label></b>
<input type="text" name="admin_email" value="" />
<hr />
<h2>Chatroom Details</h2>
<b><label for="title">Chatroom Name</label></b>
<input type="text" name="title" value="" />
<hr />
<input id="continue" type="submit" value="Continue" />
</form>
<?php else: ?>
<p>One or more critical checks failed. Please correct them before installing X7 Chat.</p>
<?php endif; ?>

Update query not working in php

there are already values inside the texboxes which i filtered inside the table(score) but i wanna update it by changing the values inside on it and click update.
Can anyone help with my code..i wanna update the values inside the (texboxes) but my code wont work can anyone help me locate the code that messing with the program?
php code:
<?php
if(isset($_POST['update'])){
//1
$u1id = $_POST['id1'];
$u1name = $_POST['name1'];
$u1score1 = $_POST['optA1'];
$u1score2 = $_POST['optB1'];
$u1other_qual = $_POST['other_qual1'];
$u1interview = $_POST['interview1'];
$u1total = $_POST['total1'];
//2
$u2id = $_POST['id2'];
$u2name = $_POST['name2'];
$u2score1 = $_POST['optA2'];
$u2score2 = $_POST['optB2'];
$u2other_qual = $_POST['other_qual2'];
$u2interview = $_POST['interview2'];
$u2total = $_POST['total2'];
//1
mysql_query("UPDATE score SET score1='$u1score1', score2='$u1score2', total='$u1total' WHERE id='$u2id'");
//2
mysql_query("UPDATE score SET score1='$u2score1', score2='$u2score2', total='$u2total' WHERE id='$u2id'");
}
?>
html code:
<form method="post" id="frm" name="frm" action="" />
<table>
<tr>
<td>
ID: <br />
<input type="text" name="id1" value="<?php if(empty($id[0])){$id[0] = array(NULL);}else{echo $id[0];} ?>" readonly /> <br />
<input type="text" name="id2" value="<?php if(empty($id[1])){$id[1] = array(NULL);}else{echo $id[1];} ?>" readonly /> <br />
</td>
<td>
Name: <br />
<input type="text" name="name1" value="<?php if(empty($name[0])){$name[0] = array(NULL);}else{echo $name[0];} ?>" readonly /> <br />
<input type="text" name="name2" value="<?php if(empty($name[1])){$name[1] = array(NULL);}else{echo $name[1];} ?>" readonly /> <br />
</td>
<td>
Score 1: <br />
<input type="text" name="optA1" value="<?php if(empty($score1[0])){$score1[0] = array(NULL);}else{echo $score1[0];} ?>" onchange="optTotal1()" /> <br />
<input type="text" name="optA2" value="<?php if(empty($score1[1])){$score1[1] = array(NULL);}else{echo $score1[1];} ?>" onchange="optTotal2()" /> <br />
</td>
<td>
Score 2: <br />
<input type="text" name="optB1" value="<?php if(empty($score2[0])){$score2[0] = array(NULL);}else{echo $score2[0];} ?>" onchange="optTotal1()" /> <br />
<input type="text" name="optB2" value="<?php if(empty($score2[1])){$score2[1] = array(NULL);}else{echo $score2[1];} ?>" onchange="optTotal2()" /> <br />
</td>
<td>
Other Qualification: <br />
<input type="text" name="other_qual1" value="<?php if(empty($other_qual[0])){$other_qual[0] = array(NULL);}else{echo $other_qual[0];} ?>" readonly /> <br />
<input type="text" name="other_qual2" value="<?php if(empty($other_qual[1])){$other_qual[1] = array(NULL);}else{echo $other_qual[1];} ?>" readonly /> <br />
</td>
<td>
Interview: <br />
<input type="text" name="interview1" value="<?php if(empty($interview[0])){$interview[0] = array(NULL);}else{echo $interview[0];} ?>" readonly /> <br />
<input type="text" name="interview2" value="<?php if(empty($interview[1])){$interview[1] = array(NULL);}else{echo $interview[1];} ?>" readonly /> <br />
</td>
<td>
Total: <br />
<input type="text" name="total1" value="<?php if(empty($total[0])){$total[0] = array(NULL);}else{echo $total[0];} ?>" readonly onKeyUp="optTotal1()" /> <br />
<input type="text" name="total2" value="<?php if(empty($total[1])){$total[1] = array(NULL);}else{echo $total[1];} ?>" readonly onKeyUp="optTotal2()" /> <br />
</td>
</tr>
</table>
<input type="submit" value="update" />
</form>
It's in your submit button:
<input type="submit" value="update" />
You have given it a value, but not a name. If you change it to:
<input type="submit" name="update" value="yespleasedososir" />
it will end up in your post var
A few thoughts: 1. Have you echoed out your sql statements to see what you are getting? 2. Try add the tilde symbol before and after each column name...like score1 = 'whatever'. 3. You should really be using the mysqli statemnts.

Issue with PHP Updating MySQL Database

I'm having issues with the form below, whenever i click on an item it catches the item and updates on the mySQL table, it only displays 1 item(how do i make it display all the items that i have checked?).
Also when i put in a quantity in it doesn't update on the mySQL table and it just says 0 when i've put multiple quantities of each item.
Are you guys able to help if that's ok?
<tr>
<th>Shirts</th>
<th>Quantity</th>
</tr>
<tr>
<td>
<br />
<input type="checkbox" name="items" value="SH01" /><label for="rd1">Obey T-Shirt: $9.99</label></div> <br />
<input type="checkbox" name="items" value="SH02" /><label for="rd1">Obey Professor: $9.99</label></div> <br />
<input type="checkbox" name="items" value="SH03" /><label for="rd1">Hustle T-Shirt: $9.99</label></div> <br />
<input type="checkbox" name="items" value="SH04" /><label for="rd1">Hip-Hop Support: $9.99</label></div> <br />
<input type="checkbox" name="items" value="SH05" /><label for="rd1">90's Shirt: $9.99</label></div> <br />
<input type="checkbox" name="items" value="SH06" /><label for="rd1">DOPE Shirt: $9.99</label></div> <br />
<br />
</td>
<td>
<br />
<input type="text" name="qty" size ="2"/><br/>
<input type="text" name="qty" size="2"/><br/>
<input type="text" name="qty" size="2"/><br/>
<input type="text" name="qty" size="2"/><br/>
<input type="text" name="qty" size="2"/><br/>
<input type="text" name="qty" size="2"/><br/>
<br />
</td>
</tr>
<tr>
<td>
<br />
<input type="checkbox" name="items" value="SO1" /><label for="rd1">Shoe - Red Lace: $19.99</label></div><br />
<input type="checkbox" name="items" value="SO2" /><label for="rd1">Shoe - Red High Top: $19.99</label></div><br />
<input type="checkbox" name="items" value="SO3" /><label for="rd1">Shoe - White: $19.99</label></div><br />
<input type="checkbox" name="items" value="SO4" /><label for="rd1">Shoe - Black: $19.99</label></div><br />
<input type="checkbox" name="items" value="SO5" /><label for="rd1">Shoe - Black High Top: $19.99</label></div><br />
<input type="checkbox" name="items" value="SO6" /> <label for="rd1">Red Basketball: $19.99</label></div><br />
<br />
</td>
<td>
<br />
<input type="text" name="qty[]" size ="2"/><br/>
<input type="text" name="qty[]" size="2"/><br/>
<input type="text" name="qty[]" size="2"/><br/>
<input type="text" name="qty[]" size="2"/><br/>
<input type="text" name="qty[]" size="2"/><br/>
<input type="text" name="qty[]" size="2"/><br/>
<br />
</td>
</tr>
<tr>
<td>
<br />
<input type="checkbox" name="items" value="SN1" /> <label for="rd1">Snapback Bullets: $29.99</label></div><br />
<input type="checkbox" name="items" value="SN2" /><label for="rd1">Snapback: $29.99</label></div><br />
<input type="checkbox" name="items" value="SN3" /><label for="rd1">Snapback Bullets: $29.99</label></div><br />
<input type="checkbox" name="items" value="SN4" /><label for="rd1">Snapback Bullets: $29.99</label></div><br />
<input type="checkbox" name="items" value="SN5" /><label for="rd1">Snapback Bullets: $29.99</label></div><br />
<input type="checkbox" name="items" value="SN6" /><label for="rd1">Snapback Bullets: $29.99</label></div><br />
<br />
</td>
<td>
<br />
<input type="text" name="qty" size ="2"/><br/>
<input type="text" name="qty" size="2"/><br/>
<input type="text" name="qty" size="2"/><br/>
<input type="text" name="qty" size="2"/><br/>
<input type="text" name="qty" size="2"/><br/>
<input type="text" name="qty" size="2"/><br/>
<br />
</td>
</tr>
</tr>
</table>
<br />
<input type="submit" name="submit">
</form>
<?php
if (isset($_POST['submit']))
{
$con = mysql_connect('$localhost','$url','$pass');
if (!$con)
{
die("Could Not Connect: " . mysql_error());
}
mysql_select_db("$username",$con);
$sql = "INSERT INTO Order_Information(Order_ID,Order_Items,Order_Quantity) VALUES (null,'$_POST[items]','$_POST[qty]')";
mysql_query($sql,$con);
mysql_close($con);
}
?>
The first thing you need to do is update in a foreach loop so that you are inserting one row for each checked item and secondly you need to relate the quantity fields to those items by using an array.
Change your Quantity field names to an array including the code for the items:
<input type="text" name="qty['SO1']" size ="2"/><br/>
<input type="text" name="qty['SO2']" size="2"/><br/>
etc ...
Then in your PHP:
foreach ($_POST['items'] as $item) {
foreach($_POST['qty'] as $key => $value) {
$quantity = 0;
if ($key == $item) {
$quantity = $value;
}
}
$sql = "INSERT INTO Order_Information(Order_Items,Order_Quantity) VALUES ('$item', '$quantity')";
.
.
}
HTML
<input type="checkbox" name="items" value="SH01" />
<input type="text" name="qty_SH01" ..../>
PHP
foreach ($_POST as $key => $val) {
if (!preg_match("/^SH/", $key)) continue;
$qty = $_POST['qty_' . $key];
$sql = "INSERT INTO Order_Information(Order_Items,Order_Quantity) VALUES ('$key', '$qty')";
}
When using the $_POST[items], you forgot about the apostrophes - $_POST['items'].
To get all checked checkboxes, you need a loop:
if(!empty($_POST['check_list']))
{
foreach($_POST['items'] as $item)
{
....
}
}

Why the mysql code is not submitting values in database

This is the code for the form:
<div id="regform">
<div id="regform-top">
<h2>User Registration</h2>
<p>Please complete this form</p>
</div>
<form id="register-form" name="register-form" action="submit.php" method="post"
class="validation">
<fieldset>
<table>
<tr>
<td>
<div class="fieldgroup">
<label for="user-name">User name*: </label>
<input type="text" id="name" name="name" value="" size="12" class="inpt" /><br
class="clear" />
</div>
<div class="fieldgroup">
<label for="password">Password*: </label>
<input type="password" id="password" name="password" value="" size="12" class="inpt"
/><br class="clear" />
</div>
</td>
<td id="form-note">
<br />
<p><strong>Form Instructions</strong></p>
<p>*Required Field</p>
</td>
</tr>
</table>
<table id="bottom-reg">
<tr>
<td><br />
<div class="fieldgroup">
<label for="firstname">First name*</label>
<input type="text" id="firstname" name="firstname" value="" size="12" class="inpt" />
<br class="clear" />
</div>
<div class="fieldgroup">
<label for="email">Email Address* </label>
<input type="text" id="email" name="email" value="" size="12" class="inpt" /><br
class="clear" />
</div>
<div class="fieldgroup">
<label for="address1">Address 1* </label>
<input type="text" id="address1" name="address1" value="" size="12" class="inpt" />
<br class="clear" />
</div>
<label for="address2">Address 2</label>
<input type="text" id="address2" name="address2" value="" size="12" class="inpt" />
<br class="clear" />
<label for="address2">Address 3</label>
<input type="text" id="address3" name="address3" value="" size="12" class="inpt" />
<br class="clear" />
<div class="fieldgroup">
<label for="country">Country*</label>
<input type="text" id="country" name="country" value="" size="12" class="inpt" /><br
class="clear" />
</div>
</td>
<td><br />
<div class="fieldgroup">
<label for="lastname">Last name*</label>
<input type="text" id="lastname" name="lastname" value="" size="12" class="inpt" />
<br class="clear" />
</div>
<div class="fieldgroup">
<label for="group">Group* </label>
<input type="text" id="name" name="group" value="" size="12" class="inpt" />
<br class="clear" />
</div>
<div class="fieldgroup">
<label for="city">City* </label>
<input type="text" id="city" name="city" value="" size="12" class="inpt" /><br
class="clear" />
</div>
<div class="fieldgroup">
<label for="city">State* </label>
<input type="text" id="state" name="state" value="" size="12" class="inpt" /><br
class="clear" />
</div>
<div class="fieldgroup">
<label for="zip">Zip*</label>
<input type="text" id="zip" name="zip" value="" size="12" class="inpt" /><br
class="clear" />
</div>
</td>
</tr>
</table>
<input type="submit" value="Register" class="submit-btn" />
</fieldset>
</form>
This is the code for submit.php:
<?php
$con = mysql_connect("localhost","viatechp_invacar","storefront72");
if (!$con)
{
die('Could not connect: ' . mysql_error());
}
mysql_select_db("viatechp_invacare", $con);
$sql="INSERT INTO registration(username,password,fname,lname,group,
address1,address2,address3, email,city,state,zip,country )
VALUES
('$_POST[name]','$_POST[password]', '$_POST[firstname]','$_POST[lastname]','
$_POST[group]','$_POST[address1]','$_POST[address2]','$_POST[address3]',
'$_POST[email]','$_POST[city]','$_POST[state]','$_POST[zip]','$_POST[country]'
)" ;
$query = mysql_query($sql) or die(mysql_error());
$results = mysql_fetch_assoc($query);
if ($results) {
echo 'The query returned ' . $results[ 'registration' ];
} else {
echo 'The query did not return any results';
} ?>
echo $sql;
?>
It is showing an error:
You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'group,address1,address2,address3,email,city,state,zip,country ) VALUES ( 'sdfdsf' at line 1
group is an SQL keyword. If this is the name of one of your fields you must enclose it with ` like so:
`group`,`address1`,...
This tells mySQL that it is a field name and not the keyword. It would be good practice to enclose all your fields within ` to prevent any errors like this you may not have noticed.
Spot on by pburgess. GROUP, ORDER are some common field names that we use while programming. Make sure to enclose these using backticks group, always a good practice.
$sql="INSERT INTO registration(username,password,fname,lname,`group`,
address1,address2,address3, email,city,state,zip,country )
VALUES
('$_POST[name]','$_POST[password]', '$_POST[firstname]','$_POST[lastname]','
$_POST[group]','$_POST[address1]','$_POST[address2]','$_POST[address3]',
'$_POST[email]','$_POST[city]','$_POST[state]','$_POST[zip]','$_POST[country]'
)" ;
Try this
$sql="INSERT INTO registration(`username`,`password`,`fname`,`lname`,`group`,
`address1`,`address2`,`address3`, `email`,`city`,`state`,`zip`,`country` )
VALUES
('$_POST[name]','$_POST[password]', '$_POST[firstname]','$_POST[lastname]',
'$_POST[group]','$_POST[address1]','$_POST[address2]','$_POST[address3]',
'$_POST[email]','$_POST[city]','$_POST[state]','$_POST[zip]','$_POST[country]')" ;
Because you got some field names which is reserved keywords like for example you have group
Your $_POST values is missing quotes, Try updating them
$sql="INSERT INTO registration
(`username`,`password`,`fname`,`lname`,`group`,`address1`,`address2`,`address3`, `email`,`city`,`state`,`zip`,`country`)
VALUES
('$_POST[\"name\"]','$_POST[\"password\"]',$_POST[\"firstname\"]','$_POST[\"lastname\"]','
$_POST[\"group\"]','$_POST[\"address1\"]','$_POST[\"address2\"]','$_POST[\"address3\"]',
'$_POST[\"email\"]','$_POST[\"city\"]','$_POST[\"state\"]','$_POST[\"zip\"]','$_POST[\"country\"]'
)" ;
Well it is too late but this might help someone. Whenever you want to check why your query doesnt' work.. Always try to echo your query and paste it to the phpmyadmin and it will throw the mySQL error which are more easy to understand that what's the issue in query

PHP - How pass user input date from one form (page) to another filling in the same info for the user to verify

I'm trying to create an order form that will pass data from it to the same form but on a different page so the user can verify their information first then they will submit the data again for emailing and be redirected to a thank you page.
The problem is I haven't been able to get the info to pass into the form (same form different page). I also have to set up a conditional when the email(s) is sent because it needs to be sent to different people depending on which parts of the form are filled out.
Any help is greatly appreciated! I have a pretty good grasp of PHP, but it's been a long time since I've used it and this has been frustrating after spending a few days online searching for an answer. I'm sure this is something easy and I'll say, "Of course".
Thank you!
https://secure.kellypromotions.com/hmcpromo/order_form.php
https://secure.kellypromotions.com/hmcpromo/verify_order_roller.php
<form id="promo_order_form" name="promo_order_form" method="post" action="verify_order_form.php">
<div id="order_form">
<span id="sprytextfield7">
<label for="Order_Date">Order Date:</label>
<input type="text" name="Order_Date" id="Order_Date" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
<br />
<br />
<span id="sprytextfield17">
<label for="Date_Needed">Date Needed:</label>
<input type="text" name="Date_Needed" id="Date_Needed" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
<br />
<br />
<span id="sprytextfield16">
<label for="AU">AU #:</label>
<input type="text" name="AU" id="AU" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
<br />
(Required for ALL orders, including credit card orders)
<br />
<br />
<span id="sprytextfield15">
<label for="Approved">Approved by:</label>
<input type="text" name="Approved" id="Approved" />
<span class="textfieldRequiredMsg">A value is required.</span></span>
<br />
(Managers approval required)
<br />
<br />
<span id="sprytextfield5">
<label for="mgrEmail">Manager Email:</label>
<input type="text" name="mgrEmail" id="mgrEmail" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
<br />
<br />
<span id="sprytextfield14">
<label for="Contact">Contact:</label>
<input type="text" name="Contact" id="Contact" />
<span class="textfieldRequiredMsg">A value is required.</span></span>
<br />
<br />
<span id="sprytextfield13">
<label for="Email">Email:</label>
<input type="text" name="Email" id="Email" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
<br />
<br />
<span id="sprytextfield12">
<label for="Phone1">Phone #:</label>
<input type="text" name="Phone1" id="Phone1" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span></span>
<br />
<br />
<span id="sprytextfield8">
<label for="Fax">Fax #:</label>
<input type="text" name="Fax" id="Fax" />
<span class="textfieldRequiredMsg">A value is required.</span></span>
<br />
<br />
<span id="sprytextfield9">
<label for="MAC">MAC #:</label>
<input type="text" name="MAC" id="MAC" />
<span class="textfieldRequiredMsg">A value is required.</span></span>
<br />
<br />
<span id="sprytextfield10">
<label for="Ship">Ship to:</label>
<input type="text" name="Ship" id="Ship" />
<span class="textfieldRequiredMsg">A value is required.</span></span>
<br />
<br />
<span id="sprytextfield11">
<label for="Attention">Attention:</label>
<input type="text" name="Attention" id="Attention" />
<span class="textfieldRequiredMsg">A value is required.</span></span>
<br />
<br />
</div>
<div id="personal_form">
<div id="personal_header">PERSONAL ORDERS ONLY:</div>
<span id="spryradio1">
<label>
<input type="radio" name="Visa" value="radio" id="Visa" />
Visa</label>
<br />
<label>
<input type="radio" name="Mastercard" value="radio" id="Mastercard" />
Mastercard</label>
<br />
<label>
<input type="radio" name="Amex" value="radio" id="Amex" />
Amex</label>
</span>
<span id="sprytextfield21">
<label for="CardNum">Card Number:</label>
<input type="text" name="CardNum" id="CardNum" />
</span>
<br />
<br />
<span id="sprytextfield18">
<label for="exp">EXP:</label>
<input name="exp" type="text" id="exp" value="MM/DD" size="10" maxlength="5" />
</span>
<span id="sprytextfield20">
<label for="cvs">CVS #:</label>
<input name="cvs" type="text" id="cvs" size="5" maxlength="3" />
</span>
<br />
<br />
<span id="sprytextfield19">
<label for="auth">Name on Card:</label>
<input name="auth" type="text" id="auth" size="40" />
</span>
</div>
<div id="delivery">
<p>Please allow 3 weeks for delivery.
<br />
<br />
Orders will ship via UPS Ground. Individual product styles will ship separately.
</p>
</div>
<br />
<ul>
<li class="clear">PERSONALIZATION INFORMATION</li>
</ul>
<div id="pers_form">
<span id="sprytextfield3">
<label for="First">First Name:</label>
<input type="text" name="First" id="First" />
<span class="textfieldRequiredMsg">A value is required.</span></span>
<span id="sprytextfield2">
<label for="Last">Last Name:</label>
<input type="text" name="Last" id="Last" />
<span class="textfieldRequiredMsg">A value is required.</span></span><br /><br />
<span id="sprytextfield4">
<label for="Phone2">Phone #:</label>
<input type="text" name="Phone2" id="Phone2" />
</span>
<span id="sprytextfield1">
<label for="Email2">Email:</label>
<input type="text" name="Email2" id="Email2" />
</span>
</div>
<div id="totals_header">
TOTAL COST
</div>
<br />
<ul>
<li>ITEM</li>
</ul>
<div id="item_form">
<h3>Executive Metal Grip Roller</h3>
<input name="ItemNum" type="hidden" id="ItemNum" value="EMGR" />
<br />
<input name="ItemPrice" type="text" id="ItemPrice" value="$1.10 Each" size="12" readonly="readonly" />
<br />
<br />
<span id="sprytextfield6">
<label for="Qty">Qty (Minimum 300):</label>
<input name="Qty" type="text" id="Qty" size="10" />
<span class="textfieldRequiredMsg">A value is required.</span><span class="textfieldInvalidFormatMsg">Invalid format.</span><span class="textfieldMinValueMsg">The entered value is less than the minimum required.</span> </span><br />
<br />
<label for="Total">Total:</label>
<input name="Total" type="text" id="Total" size="25" readonly="readonly" />
<br />
<hr />
<input type="submit" name="Submit" id="Submit" value="Submit" />
<br />
</div>
<div id="totals_form">
<label for="Subtotal">Subtotal</label>
<input name="Subtotal" type="text" id="Subtotal" size="15" readonly="readonly" />
<br />
<br />
<label for="Sales_Tax">Sales Tax (MN only)</label>
<input name="Sales_Tax" type="text" id="Sales_Tax" size="15" />
<br />
<br />
<label for="P_H">Packaging and Handling</label>
<input name="P_H" type="text" id="P_H" value="$3.75" size="15" readonly="readonly" />
<br />
<br />
<label for="Freight">Freight</label>
<input name="Freight" type="text" id="Freight" size="15" readonly="readonly" />
<br />
<hr />
<label for="Totals">Total</label>
<input name="Totals" type="text" id="Totals" size="15" readonly="readonly" />
</div>
<div class="clear"><!--CLEAR--></div>
</form>
<?php
//Order Form Var
$Order_Date = strip_tags($_POST['Order_Date']);
$Date_Needed = strip_tags($_POST['Date_Needed']);
$AU = strip_tags($_POST['AU']);
$Approved = strip_tags($_POST['Approved']);
$mgrEmail = strip_tags($_POST['mgrEmail']);
$Contact = strip_tags($_POST['Contact']);
$Email = strip_tags($_POST['Email']);
$Phone1 = strip_tags($_POST['Phone1']);
$Fax = strip_tags($_POST['Fax']);
$MAC = strip_tags($_POST['MAC']);
$Ship = strip_tags($_POST['Ship']);
$Attention = strip_tags($_POST['Attention']);
//Personal Order Form Var
$Visa = strip_tags($_POST['Visa']);
$Mastercard = strip_tags($_POST['Mastercard']);
$Amex = strip_tags($_POST['Amex']);
$exp = strip_tags($_POST['exp']);
$cvs = strip_tags($_POST['cvs']);
$auth = strip_tags($_POST['auth']);
//Personalization Form Var
$First = strip_tags($_POST['First']);
$Last = strip_tags($_POST['Last']);
$Phone2 = strip_tags($_POST['Phone2']);
$Email2 = strip_tags($_POST['Email2']);
//Item Form Var and Math
$ItemNum = strip_tags($_POST['ItemNum']);
$ItemPrice = strip_tags($_POST['ItemPrice']);
$ItemNum = strip_tags($_POST['ItemNum']);
$Qty = strip_tags($_POST['Qty']);
$Total = strip_tags($_POST['Total']);
//Totals Form Math
$Subtotal = strip_tags($_POST['Subtotal']);
$Sales_Tax = strip_tags($_POST['Sales_Tax']);
$P_H = strip_tags($_POST['P_H']);
$Freight = strip_tags($_POST['Freight']);
$Totals = strip_tags($_POST['Totals']);
?>
session_start();
and then
$_SESSION['key1'] = $val1;
$_SESSION['key2'] = $val2;
Do that for all the data. And then access the stuff using $_SESSION['key']
Your form is already posting to the second form so you don't need session variables. You can retrieve the values using $_POST['input_name'] on the verify page, if you need to verify what fields are being posted to the page you can use print_r($_POST)

Categories