我試圖爲我的購物車製作數量框,但不知道如何將值存儲在我的數據庫中。將輸入值存儲到數據庫中
<?php
$db = mysqli_connect('localhost', 'root', '', 'store');
$select_product = mysqli_query($db, "SELECT * FROM cart WHERE id = 0");
$select_product_values = mysqli_fetch_assoc($select_product);
$product_quantity = select_product_values['quantity'];
echo "<input type='text' maxlength='2' name='quantity' value=".$product_quantity." class='quantity_box'/>";
echo "<form action='checkout.php' method='post'><button type='submit' id='checkout'>Checkout</button></form>";
mysqli_close($db);
?>
什麼將update
的quantity
結賬時,value
最簡單的方法?
您是否在討論如何在後端數據庫中構建'UPDATE'語句或如何從此HTML文本框中獲取此數量值? – Lion 2013-04-24 01:34:07
我正在討論獲取此HTML文本框的數量值。 – Dany 2013-04-24 01:37:33