I've got the following script. It allows a user to input a quantity, then the new price is updated. But there seems to be a code error (in that is doesn't update for the new price).
Can anyone see where the error might be?
Code:<?php if(isset($_POST["quantity"])) $quantity = settype($_POST["quantity"], "integer"); else $quantity = 1; $item_price = 10.99; printf("%d x item = $%.2f", $quantity, $quantity * $item_price); ?> <FORM ACTION="buy.php" METHOD=POST> Update quantity: <INPUT NAME="quantity" SIZE=2 value =<?php echo $quantity;?>"> <INPUT TYPE=SUBMIT VALUE="Change quantity and re-calculate price"> </FORM>




Reply With Quote