I have a form that I want to pass the 4 variable onto the next page. I'm not able to get the variables to the next page, but I'm able to echo them thru error check on my page.
I'm not sure if I understand how to do this, so I'm asking for a little help.
Here is my code:
<?php
if (isset($_POST['submitted'])) {
//Initialize error array
$errors = array();
//check for a QUANTITY
if (empty($_POST['quantity'])) {
$errors[] = 'You forgot the quantity.';
}
//check for a order number
if (empty($_POST['order_num'])) {
$errors[] = 'You forgot the order number.';
}
//check for a item number
if (empty($_POST['item_num'])) {
$errors[] = 'You forgot the item number.';
}
//check for a price
if (empty($_POST['price'])) {
$errors[] = 'You forgot the price.';
}
//Check for Total errors
if(empty($errors)) {
//transfer to another page as all fields are filled
//echo $price;
$price=$_POST['price'];
echo $price;
echo "<br />";
$item_no=$_POST['item_num'];
echo $item_no;
$order_no=$_POST['order_num'];
echo $order_no;
$quantity=$_POST['quantity'];
echo $quantity;
header("Location: horiz_entry_sn.php");
//if - else $errors
} else {
//report the errors
echo '<h1>Error!</h1>The following error(s) occurred: <br /><p>';
foreach ($errors as $msg) {
//print the errors message
echo "- $msg<br />\n";
}
echo '<p><p>Please go back and try again</p></p>';
}
//if - else statement isset
} else {
?>
<script>
function toForm() {
document.horiz.quantity.focus();
}
</script>
<html>
<head>
<title>Intranet</title>
</head>
<body onload="toForm()" BGCOLOR=#FFFFFF topmargin="0" leftmargin="0"
marginheight=0 marginwidth=0 rightmargin=0 bottommargin=0>
<center>
<table border=0 cellpadding=0 cellspacing=0 width=100% vailn=top>
<!-- server side include leftside nav table -->
<!-- end of left side nav -->
<br>
<form name="horiz" method="post" action="horiz_entry_2.php">
<div align="center">
<p> </p>
<table width="350" border="1" cellpadding="2" bordercolor="#000033"
style='border-collapse: collapse'>
<tr>
<td colspan="3" bgcolor="#000066"><div align="center"><strong>
<font color="#FFFFFF" size="2" face="Arial, Helvetica, sans-serif">Add an Order</font></strong></div></td>
</tr>
<tr>
<td>
<table border=0 cellpadding=3 cellspacing=0 width=99%>
<tr>
<td width=100%><font size="2" face="ARIAL, SANS-SERIF">
<p><strong>Quantity:</strong><br>
<input type="text" name="quantity" size=50 maxlength=75>
</p>
<p><strong>Order Number:</strong><br>
<input type="text" name="order_num" size=50 maxlength=75>
</p>
<p><strong>Item Number:</strong><br>
<input type="text" name="item_num" size=50 maxlength=75>
</p>
<p><strong>Price:</strong><br>
<input type="text" name="price" size=50 maxlength=75>
</p>
</td>
</tr>
<tr>
<td colspan="3"> </td>
</tr>
<tr>
<td colspan="3"><div align="center">
<input type="submit" name="submit" value="submit">
<input type="hidden" name="submitted" value="true" />
</div></td>
</tr>
</table>
<?php
}
?>
Thanks for any help you can provide.
A