Hi All,

I'm a newbie and try to learn a little php, so a searched the internet for
documentation and wow...find a real course.
Fanatic I typed the code below and ..yes the first part of my form works
fine:

 My first orderform...looks cool, works fine
Orderform.html

************************************************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>orderform</title>
</head>
<body>
<form action="processorder.php" method="post">
<table border="0">
<bgcolor="#CCCCCC">
<td>width=150;item</td>
<td>width=15;Quantity</td>
<tr>
<td>Tires</td>
<td align="center"><input type="text" name="tireqty" size="3"
maxlength="3"></td>
</tr>
<tr>
<td>Oil</td>
<td align="center"><input type="text" name="oilqty" size="3"
maxlength="3"></td>
</tr>
<tr>
<td>Spark Plug</td>
<td align="center"><input type="text" name="sparkqty" size="3"
maxlength="3"></td>
</tr>
<tr>
<td colspan="2" align="center"><input type="submit" value=
"Submit Order"></td>
</tr>
</table>
</form>
</body>
</html>
*****************************************************

Now I'd like to show what my virtual client ordered.....works  fine too

*****************************************************
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Bob's Auto Parts - Order Results</title>
</head>
<body>
<h1>Bob's Auto Parts</h1>
<h2>Order Results</h2>
<?
echo "<p>Order processed at ";
echo date("H:i, jS F");
echo "<br>";
echo "<p>Your order is as follows:";
echo "<br>";
echo $_POST["tireqty"]." Tires<br>";
echo $_POST["oilqty"]." Bottles of oil<br>";
echo $_POST["sparkqty"]." Sparks<br>";
***********************************************

Now I'd like to show what my virtual client has to pay....and there it goes
wrong :-((
*****************************************************
define("TIREPRICE", 100);
define("OILPRICE", 10);
define("SPARKPRICE", 4);
$totalqty = $_POST["tireqty"] + $_POST["oilqty"] + $_POST["sparkqty"];
$totalamount = $_POST["tireqty"] * TIREPRICE + $_POST["oilqty"] * OILPRICE +
$_POST["sparkqty"] * SPARKPRICE;
$totalamount = number_format($totalamount, 2);
echo "<br>\n";
echo "Items ordered: ".$_POST["totalqty"]."<br>\n";
echo "Subtotal: $".$_POST["totalamount"]."<br>\n";
$taxrate = 0.10; // local sales tax is 10%
$totalamount = $totalamount * (1 + $taxrate);
$totalamount = number_format($totalamount, 2);
echo "Total including tax: $".$totalamount."<br>\n";
*******************************************
I see the following errors:

********************************************

Notice: Undefined index: totalqty in processorder.php on line 29
Items ordered:

That's in this rule:
echo "Items ordered: ".$_POST["totalqty"]."<br>\n";

and......

Notice: Undefined index: totalamount in processorder.php on line 30
Subtotal: $
Total including tax: $3.30

That's in this rule:
echo "Subtotal: $".$_POST["totalamount"]."<br>\n";

*************************************************
What went wrong, can someone help me with this..??

Tanks for reading

Kind regards

 Marco



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to