我使用php創建比薩訂購網站。現在我想回顯通過表單中的URL傳遞的變量。我知道如何檢索這些數據:<?php echo $_GET["numpizzas"]; ?>
。但我不知道將其添加到我的html表單字段的正確方法。任何幫助深表感謝使用PHP變量填充輸入字段
<?php
echo
'<form action="pizza.php" method="post">
<h1>Thanks for Ordering. Please submit your delivery info.</h1>
<label>Name:</label> <input type="text" name="name">
<label>Address:</label> <input type="text" name="address">
<label>Phone:</label> <input type="text" name="phone">
<label>Money: </label><input type="text" name="money" value="<?php echo "hi"; ?>" >
//Money field does not populate with number, I just see <?php echo $_GET[
<label>Feedback:</label> <input type="text" name="feedback">
<input type="submit" value="Submit">
</form>';
?>
<?php echo $_GET["numpizzas"]; ?>
我也試過存放在變量$howmanypizzas = $_GET["numpizzas"]; ?>
的整數,但它仍然沒有顯示爲字段值。
是的頁面是PHP擴展 – st4rgut