$totalamount = (($tireqty TIREPRICE) $discount) + ($oilqty OILPRICE) + ($sparkqty SPARKPRICE);
$totalamount = number_format($totalamount, 2);
echo "<br>\n";
echo "Items ordered: ".$totalqty."<br>\n";
echo "Subtotal: $".$totalamount."<br>\n";
$taxrate = 0.085; // local sales tax is 8.5%
$totalamount = $totalamount + ($totalamount * 1.085);
$totalamount = number_format($totalamount, 2);
echo "Total including tax: $".$totalamount."<br>\n";
Okay, see the line "$totalamount = number_format($totalamount, 2)"? It's used in two places to format $totalamount to two digits' place after the decimal point, for "cents".
If I leave it in the first time it appears--right after the "$totalamount = (($tireqty TIREPRICE) $discount) + ($oilqty OILPRICE) + ($sparkqty SPARKPRICE);"--that's when I get the ridiculous, tiny number for $totalamount when I place a number in the form for number of tires ordered--but not if I order some combo of oil and/or spark plugs.
If I take out the first appearance of the line for "number_format", the code works, and the final number (including the correct amount of sales tx added in) appears, and it's formatted to "cents". The only problem is that there's no "cents" formatting--i.e., the subtotal ($totalamount before sales tax is calculated and added in)--is echo'd as an integer.
I'm closer, but still at my wit's end and not proceeding any farther with this tutorial. Anyone, see anything? Chaptic Reality, have you successfully proceeded any farther in the tutorial? If so, how'd you gewt past where I am?
Thank you.
Steve Tiano