I have this simple script for calculating a total price by mulitplying the QTY by the item price. Then multiplying the shipping price and QTY. Then it adds the new Item Price to the new shipping price. how ever once you type in 15 for the QTY the math no longer works and you get a weird total.
here is the code:
<?php
$quantity = 1;
$bookprice = number_format(70.00, 2);
$shippingprice = number_format(4.95, 2);
$total = number_format($bookprice + $shippingprice, 2);
if($_POST['quantity']) {
$quantity = $_POST['quantity'];
$bookprice = number_format($bookprice * $quantity, 2);
$shippingprice = number_format($quantity * $shippingprice, 2);
$total = number_format($bookprice + $shippingprice, 2);
}
?>
You can also view the page at http://www.sono-tek.com/bookoffer/bookprocess.php
Thanks for the help.