I have register_global = off.  I know I have to use
$HTTP_POST_VARS["VarName"] to refer to the variable but what if I need it in
a calculation formula? and many variables in that formula. Ex:

<?php
echo "<p>Your order is as follows:</p><br>";
echo $HTTP_POST_VARS["tireqty"]. " tires<br>";
echo $HTTP_POST_VARS["oilqty"]. " bottles of oil<br>";
echo $HTTP_POST_VARS["sparkqty"]. " spark plugs<br>";
$totalqty =  0;
$totalamount = 0.00;

define("TIREPRICE",100);
define("OILPRICE",10);
define("SPARKPRICE",4);

------------   This is where I would like to know how to
proceed -------------------

$totalqty = $tireqty + $oilqty + $sparkqty;
$totalamount = ($tireqty * TIREPRICE) + ($oilqty * OILPRICE) + ($sparkqty *
SPARKPRICE);
$totalamount = number_format($totalamount, 2);

echo "<br>\n Items ordered: ".$totalqty."<br>\n";
echo "Subtotal: $".$totalamount."<br>\n";
$taxrate = 0.10;
$totalamount = number_format($totalamount, 2);
echo "Total including tax: $".$totalamount."<br>\n";
?>

Am I supposed to replace each variable with the the longer version? aka
$HTTP_POST_VAR[]?

$totalqty = $tireqty + $oilqty + $sparkqty;
---------- change it to -----------
$totalqty = $HTTP_POST_VAR["tireqty"] + $HTTP_POST_VAR["oilqty"] +
$HTTP_POST_VAR["sparkqty"]

and what about the $totalqty variable that has just been created? How do I
refer to it?
$HTTP_SESSION_VAR["totalqty"]?



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

Reply via email to