我正在学习一本书的教程,但我被卡住了。
这是 html 订单 (orderform.html)
<!doctype html>
<html>
<head>
</head>
<body>
<form action='processorder.php' method="post">
<table border=0>
<tr bgcolor=#cccccc>
<td width=150>Item</td>
<td width=15>Quantity</td>
</tr>
<tr>
<td>Tires</td>
<td align=center><input type="text" name="tireqty" size=3 maxlength=3></td>
</tr>
<tr>
<td>Oil</td>
<td align=center><input type="text" name="oilqty" size=3 maxlength=3></td>
</tr>
<tr>
<td>Spark Plugs</td>
<td align=center><input type="text" name="sparkqty" size=3 maxlength=3></td>
</tr>
<tr>
<td colspan=2 align=center><input type=submit value="submit order"></td>
</td>
</table>
</form>
这是流程订单表(processorder.php)
<!doctype html>
<html>
<head>
<title>Bobs auto parts - Order Results</title>
</head>
<body>
<h1>Bob's Auto Parts</h1>
<h2>Order Results</h2>
<?php
echo "<p>Order processed at ";
echo date("1 jS \of F Y h:i:s: A");
echo "<br>";
echo "<p>Your order is as follows:";
echo "<br>";
echo $tireqty." tires<br>";
echo $oilqty." bottles of oil<br>";
echo $sparkqty." spark plugs<br>";
var_dump($_POST);
?>
当我在 processorder.php 上 var_dump $_POST 时,它说它们在数组中,但是当我尝试回显变量时,它给了我一个通知,说我试图结转的变量是未定义的。请帮忙 :(