在这段代码中,它应该改变数量,但它没有改变。它总是设置值'1'。
<?php
if(isset($_POST["quantity"]))
$quantity = settype($_POST["quantity"], "integer");
else
$quantity = 1;
$item_price = 5.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">
</FORM>
</body>
</html>