-1
echo "<form method='post' action='proceed.php'>";
while ($row = $stmt->fetch(PDO::FETCH_ASSOC)){
extract($row);
echo "<tr>";
echo "<td>{$name}<input type='hidden' name='itemid' value='{$itemid}'></td>";
echo "<td>${$price}</td>";
echo "<td>";
echo "<a href='remove_from_cart.php?id={$id}&name={$name}' class='btn btn-danger'>";
echo "<span class='glyphicon glyphicon-remove'></span> Remove from cart";
echo "</a>";
echo "</td>";
echo "</tr>";
$total_price+=$price;
}
echo"<input type='hidden' name='itemsprice' value='{$total_price}' id='itemsprice'>";
echo "<tr>";
echo "<td><b>Total</b></td>";
echo "<td>${$total_price}</td>";
echo "<td>";
echo "<input type='submit'>";
echo "</a>";
echo "</td>";
echo "</tr>";
echo "</table>";
echo "</form>";
}
你好,基本上我想做的是製作一個PHP cart/shop系統,並且我想讓每一行都發送一個變量給proceed.php,我必須把裏面的mysql取得聯合這個工作?當我有mysql提取assoc時,PHP在表單中提交更多變量?