提交页面
<!DOCTYPE html>
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
</head>
<body>
<form action="jieshou.php" method="get">
<table>
<tr>
<td>请输入名字</td><td><input type="text" name="name"></td>
<td>请输入年龄</td><td><input type="text" name="age"></td>
<td colspan="2"><input type="submit" value="提交"></td>
</tr>
</table>
</form>
</body>
接收页面
<?php
$name=$_GET['name'];
$age=$_GET['age'];
echo "接收到的名字是: ".$name."<br/> 接收到的年龄是: ".$age;
?>
form 表单的提交方式有两种:get 方式提交 和 post 方式提交!
这两种方式的区别有一下几点:
1 get 方式提交后刷新和后退不会从新提交! post 方式提交后刷新和后退post数据会从新提交!
2 get 书签可以收藏,post书签不可以收藏
3 get 历史参数保留在浏览器历史中。 post 参数不会保存在浏览器历史中。
4 get 对数据长度有限制(最大长度是 2048 个字符); post 则无限制
5 get 的安全性较差 get 的数据在 URL 中对所有人都是可见的。 post 的数据不会显示在 URL 中。
post 比 get 更安全,因为参数不会被保存在浏览器历史或 web 服务器日志中。