在传递参数时form标签的method属性值是这两个值,除了是否在浏览器上直接显示参数外,他们有什么区别呢?貌似用post的时候 action属性的值设置为百度的主页(随便一个网页)时处理不了,用get时候,action的值用百度就可以显示用get:
 <form name="login"
     method="get"
     action="http://www.baidu.com/index.php?tn=ichuner_4_pg">
     <!--  action属性(必需!):说明了接收和处理表单数据的应用程序的URL-->
 <table width="300" border="5" cellspacing="0" cellpadding="0">
 <tr>
  <td height="30"><?php echo $_GET[user];?>&nbsp;</td>
 </tr>
 <tr>
  <td height="30"
  align="center"
  valign="middle">
  <input type="text" name="user" size="20"/></td>
 </tr>
 <tr>
  <td height="30"
  align="center"
  valign="middle">
  <input type="submit" name="submit" value="提交"/></td>
 </tr>
 </table>
 </form>用post:
<form name="login" method="post" action="http://www.baidu.com/index.php?tn=ichuner_4_pg">
<table width="300" border="0" cellspacing="0" cellpadding="0">
<tr>
<td height="30"><?php echo $_POST[user];?>&nbsp;</td>
</tr>
<tr>
<td height="30" align="center" valign="middle">
<input type="text" name="user" size="20"/>
</td>
</tr>
<tr>
<td height="30" align="center" valign="middle">
<input type="submit" name="submit" value="提交"/>
</td>
</tr>
</table>
</form>

解决方案 »

  1.   

    $_POST['user']:接收post方式发送的数据
    $_GET['user']:接收get方式发送的数据如果百度是用第二种:接收get方式发送的数据。你用post发,当然接收不到了。
      

  2.   

    哦,那就是说method属性的GET和POST这两个提交方法对应的接收变量要一致咯,百度是用$_GET['user']变量接收数据的,所以你提交数据的网页只能用GET方法,可能是这样~