.在PHP中,如何获取表单FORM通过GET或POST方法提交的参数值?

如题所述

test1.php

<form action="test2.php" method="post">
<input type="text" name="username" /><br/>
<input type="password" name="pw" /><br/>
<input type="submit" name="sbmit" value="提交" />
</form>

test2.php

<?php
$username = $_POST['username'];
$pw = $_POST['pw'];
echo "用户名:".$username;
echo "<br/>";
echo "密码:".$pw;
?>

test2.php 这里也可以这样写。

<?php
extract($_POST);
echo "用户名:".$username;
echo "<br/>";
echo "密码:".$pw;
?>
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-07-14
这是前面你要发送ID 的网页<form action='wang_ye_di_zhi.php' method='post'><input type='checkbox' name='id'></form>这是收到ID网页$id_variable=$_POST["id"];
第2个回答  2013-07-14
在处理页,用$_POST[]和$GET[]两个大数组获取。
第3个回答  2013-07-14
可以这样<input type=hidden name=id value= >试验下具体不知道你干嘛用 不过这样可以做到 一般后台修改新闻等用这种方法