HTML表单传值示例通过get方式传递
(编辑:jimmy 日期: 2025/2/23 浏览:3 次 )
google.html界面如图
代码如图:(比较简单,就是一个input输入框和input提交按钮,注意type为submit,而不是button)
复制代码代码如下:
<html>
<head>
<title>Winbobo</title>
</head>
<body>
<div align="center">
<form action="google.php" method="get">
<input name="q" type="text"/>
</br>
<input name="btnSearch" type="submit" value="Search" />
</form>
</div>
</body>
</html>
google.php的代码如图:($_GET用于获取表单通过get方式传递的数据; $_POST用于获取表单通过post方式传递的数据)
复制代码代码如下:
<?php
print "<pre>";
print_r($_GET);
print "</pre>";
?>
运行结果如图:


代码如图:(比较简单,就是一个input输入框和input提交按钮,注意type为submit,而不是button)
复制代码代码如下:
<html>
<head>
<title>Winbobo</title>
</head>
<body>
<div align="center">
<form action="google.php" method="get">
<input name="q" type="text"/>
</br>
<input name="btnSearch" type="submit" value="Search" />
</form>
</div>
</body>
</html>
google.php的代码如图:($_GET用于获取表单通过get方式传递的数据; $_POST用于获取表单通过post方式传递的数据)
复制代码代码如下:
<?php
print "<pre>";
print_r($_GET);
print "</pre>";
?>
运行结果如图:

下一篇:网站不允许直接复制页面内容或信息的解除方法