Home  >  Article  >  Backend Development  >  为啥php获取不到post提交的值

为啥php获取不到post提交的值

WBOY
WBOYOriginal
2016-06-13 12:26:12822browse

为什么php获取不到post提交的值
nbsp;html>



在PHP中获取表单数据


 


   
   
   
   
   
   
   
   
    
   
    
    
    
用户名:
密码:

    
    


      if($_POST["submit"]=="登录")
  {
  echo "您输入的用户名为:".$_POST[user];
  echo "密码为:".$_POST[pwd];
  }
  else
  {
  echo "error";
  }


?>


------解决思路----------------------
from错了哇

应该是form
------解决思路----------------------
<br /><html><br /><head><br /><meta charset="utf-8"><br /><title>在PHP中获取表单数据</title><br /></head><br /><br /><body> <br /><br /><form name="from1" method="post" action="4.php"><br /><table width="405" border="1" cellpadding="1" cellspacing="1"><br />   <tr><br />   <td width="103" height="25" align="right">用户名:</td><br />   <td align="left"><input type="text" name="user" size="20"></td><br />   </tr><br />   <br />   <tr><br />   <td width="103" height="25" align="right">密码:</td><br />   <td align="left"><input type="password" name="pwd" id="pwd" size="20"></td><br />   </tr> <br />   <br />    <tr><br />    <td align="center" colspan="2"><br />    <input type="submit"   name="submit"  id="submit" value="登录"><br />    </td><br />    </tr><br /></table><br /></form><br /><?php<br />      if($_POST["submit"]=="登录")<br />  {<br />  echo "您输入的用户名为:".$_POST[user];<br />  echo "密码为:".$_POST[pwd];<br />  }<br />  else<br />  {<br />  echo "error";<br />  }<br /><br /><br />?><br /></body><br /></html><br />更多<br />0<br />分享到: <br />



OK了
------解决思路----------------------
form name="from1" method="post" action="7.php">
form>
------解决思路----------------------
php有3种获取post值得方式 请都试试 
有空能 _post不能解析你的变量 或者是怎么样的
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn