Heim  >  Artikel  >  Backend-Entwicklung  >  为什么php获取不到post提交的值

为什么php获取不到post提交的值

WBOY
WBOYOriginal
2016-06-23 13:24:111069Durchsuche

nbsp;html>



在PHP中获取表单数据


 


   
   
   
   
   
   
   
   
    
   
    
    
    
用户名:
密码:

    
    


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


?>


回复讨论(解决方案)

from错了哇

应该是form

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



OK了


form>

php有3种获取post值得方式 请都试试 
有空能 _post不能解析你的变量 或者是怎么样的

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:PHP模拟赶集登陆,需要验证码问题Nächster Artikel:新手提问