>  기사  >  백엔드 개발  >  为啥php获取不到post提交的值

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

WBOY
WBOY원래의
2016-06-13 12:26:12824검색

为什么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不能解析你的变量 或者是怎么样的
성명:
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.