Form Problem help
Posted: Mon Aug 25, 2003 2:16 am
Hi All,
I am having problems with the following form when I enter and address into the address field it doesn`t output to the processorder page. here are the codes can anyone help?
The form:
The process order page:
mod_edit: added code and php tags
everything else works ok when submitted but its only the Address field that when i enter text mnothing echos to the processorder.php page...
I am having problems with the following form when I enter and address into the address field it doesn`t output to the processorder page. here are the codes can anyone help?
The form:
Code: Select all
<html>
<head>
<title>Hazels Garage</title>
</head>
<body>
<h1>Hazels Garage</h1>
<h2>Order Form</h2>
<form action="processorder.php" method=post>
<table border=0>
<tr bgcolor=#cccccc>
<td width=150>Item</td>
<td width=15>Quantity</td>
</tr>
<tr>
<td>Tires</td>
<td align=left><input type="text" name="tireqty" size=3 maxlength=3></td>
</tr>
<tr>
<td>Oil</td>
<td align=left><input type="text" name="oilqty" size=3 maxlength=3></td>
</tr>
<tr>
<td>Spark Plugs</td>
<td align=left><input type="text" name="sparkqty" size=3 maxlength=3></td>
</tr>
<tr>
<td>Shipping Address</td>
<td align=center><input type="text" name="address" size=40 maxlength=40></td>
</tr>
<tr>
<td colspan=2 align=center><input type=submit value="Submit Order"></td>
</tr>
</table>
</form>
</body>
</html>Code: Select all
<html>
<head>
<title>Hazels Garage - Order Results</title>
</head>
<body>
<h1>Hazels Garage</h1>
<h2>Order Results</h2>
<?
$totalqty = 0;
$totalqty += $tyreqty;
$totalqty += $oilqty;
$totalqty += $sparkqty;
$totalamount = 0.00;
define("TYREPRICE", 100);
define("OILPRICE", 10);
define("SPARKPRICE", 4);
$date = date("H:i, jS F");
echo "<p>Order processed at ";
echo $date;
echo "<br>";
echo "<p>Your order is as follows:";
echo "<br>";
if( $totalqty == 0 )
{
echo "You did not order anything on the previous page!<br>";
}
else
{
if ( $tyreqty>0 )
echo $tyreqty." tyres<br>";
if ( $oilqty>0 )
echo $oilqty." bottles of oil<br>";
if ( $sparkqty>0 )
echo $sparkqty." spark plugs<br>";
}
$total = $tyreqty * TYREPRICE + $oilqty * OILPRICE + $sparkqty * SPARKPRICE;
$total=number_format($total, 2, ".", " ");
echo "<P>Total of order is ".$total."</p>";
echo "<P>Address to ship to is ".$address."<br>";
$outputstring = $date."\t".$tyreqty." tyres \t".$oilqty." oil\t"
.$sparkqty." spark plugs\t\$".$total
."\t". $address."\n";
// open file for appending
@ $fp = fopen("../../orders/orders.txt", "a");
flock($fp, 2);
if (!$fp)
{
echo "<p><strong> Your order could not be processed at this time. "
."Please try again later.</strong></p></body></html>";
exit;
}
fwrite($fp, $outputstring);
flock($fp, 3);
fclose($fp);
echo "<p>Order written.</p>";
?>
</body>
</html>everything else works ok when submitted but its only the Address field that when i enter text mnothing echos to the processorder.php page...