Jump to content

very simple script not working


carolsue

Recommended Posts

below is my script but it does not add the total or print the quantity. I have included what the output looks like at the end of the script thanks!!! any help would be appreciated! my file www.completeskincaretherapy.com/fororder.html<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="generator" content="NoteTab Pro"><title>*** Your Title Here ***</title></head><title> Bob's Auto Parts - Order Results </title><body><?php//create short variable names$tireqty = $HTTP_POST_VARS['tireqty'];$oilqty = $HTTP_POST_VARS['oilqty'];$sparkqty = $HTTP_POST_VARS['sparkqty'];?><h1> Bob's Auto Parts </h1><h2> Order Results </h2><?phpecho '<p> Order Processed at ';echo date('H:i, jS F');echo '</p>';echo '<p> Your order is as follow: </p>';echo $tireqty. ' tires<br />';echo $oilqty. ' bottles of oil<br />';echo $sparkqty. ' spark plugs<br />';$totalqty = 0;$totalqty = $tireqty + $oilqty + $sparkqty;echo 'tems 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.10; //local slaes tax is 10%$totalamount = $totalamount * (1 + $taxrate);echo 'Total including tax: $'.number_format($totalamount,2). '<br />';?></body></html>OUTPUTBob's Auto Parts Order Results Order Processed at 04:07, 1st MayYour order is as follow: tiresbottles of oilspark plugstems ordered: 0Subtotal: $0.000Total including tax: $0.00

Link to comment
Share on other sites

It all depends on what version of php you are using, and if register_globals is set to on.I would try it using$tireqty = $_POST['tireqty'];$oilqty = $_POST['oilqty'];$sparkqty = $_POST['sparkqty'];It is the normal method and should work in both cases stated above.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...