Home > Backend Development > PHP Tutorial > 为什么php获取不到post提交的值

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

WBOY
Release: 2016-06-23 13:24:11
Original
1149 people have browsed it

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分享到: 
Copy after login



OK了


form>

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

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template