undefined index: tireqty
Posted: Thu Jul 31, 2003 7:56 am
I am a newb. PLEASE HELP!
I am getting an undefined index on lines 2,3,4 tireqty, oilqty, and sparkqty with the following code:
<?PHP
$tireqty = $HTTP_POST_VARS ['tireqty'];
$oilqty = $HTTP_POST_VARS ['oilqty'];
$sparkqty = $HTTP_POST_VARS ['sparkqty'];
?>
Here is the rest of the script:
<?PHP
echo '<p>Your order is as follows: </p>';
echo $tireqty.' tires<br />';
echo $oilqty. 'bottles of oil<br />';
echo $sparkqty. 'spark plugs<br />';
$totalqty = 0;
$totalqty = $tireqty = $oilqty = $sparkqty;
echo 'Items ordered: '.$totalqty.'<br />';
$totalamount = 0.00;
define ('TIREPRICE', 100);
define ('OILPRICE', 10);
define ('SPARKPRICE', 4);
$totalamount = $tireqty * TIREPRICE
+ $oilqty * OILPRICE
+ $sparkqty * SPARKPRICE;
ECHO 'Subtotal: $'.number_format ($totalamount,3).'<br />';
$taxrate = 0.065; //local sales tax is 6.5%
$totalamount1 = $totalamount*( 1 + $taxrate );
echo 'Total including tax: $'.number_format($totalamount1,2).'<br />';
?>

I am getting an undefined index on lines 2,3,4 tireqty, oilqty, and sparkqty with the following code:
<?PHP
$tireqty = $HTTP_POST_VARS ['tireqty'];
$oilqty = $HTTP_POST_VARS ['oilqty'];
$sparkqty = $HTTP_POST_VARS ['sparkqty'];
?>
Here is the rest of the script:
<?PHP
echo '<p>Your order is as follows: </p>';
echo $tireqty.' tires<br />';
echo $oilqty. 'bottles of oil<br />';
echo $sparkqty. 'spark plugs<br />';
$totalqty = 0;
$totalqty = $tireqty = $oilqty = $sparkqty;
echo 'Items ordered: '.$totalqty.'<br />';
$totalamount = 0.00;
define ('TIREPRICE', 100);
define ('OILPRICE', 10);
define ('SPARKPRICE', 4);
$totalamount = $tireqty * TIREPRICE
+ $oilqty * OILPRICE
+ $sparkqty * SPARKPRICE;
ECHO 'Subtotal: $'.number_format ($totalamount,3).'<br />';
$taxrate = 0.065; //local sales tax is 6.5%
$totalamount1 = $totalamount*( 1 + $taxrate );
echo 'Total including tax: $'.number_format($totalamount1,2).'<br />';
?>