orderform.html
<form action="processorder.php"method= "post">
<table border="0";>
<tr bgcolor="#cccccc">
<td width = "150">Item</td>
<td width="15">Quantuty</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>
</tr>
</table>
</form>
image.png
processorder.php
<html>
<head>
<titli>
Bob 's Auto Parts - Order Results
</titli>
</head>
<body>
<h1>Bob 's Auto Parts</h1>
<h2>Order Results</h2>
<?php
echo'<p>Order processed.</p>';
?>
<body/>
</html>
submit后
image.png
改成
<?php
echo "<p>Order processed at".date('H:i, jS F Y')."</p>";
?>
image.png
php用来实现动态,若要调用表单变量,用$_POST['tireqty']或者$_REQUSET['tireqty'];
网友评论