Home > Backend Development > PHP Tutorial > 无法得到post过来的值,该怎么解决

无法得到post过来的值,该怎么解决

WBOY
Release: 2016-06-13 10:14:08
Original
824 people have browsed it

无法得到post过来的值


 
 
 
 
 
 
 
 
 
 
 
 
 
Username
Password

 

初学php,为什么上面无法把name和password传到secret.php里,导致每次都输出Please input an effective username and password?
//secret.php
 //Create short names for variables
 if($_POST['name']==''&&$_POST['password']=='')
 {
//Visitor need to enter a name and password
echo '

Please input an effective username and password

';
 }
 elseif($_POST['name']=='root'&&$_POST['password']=='123')
 {
echo '

Welcome to the New World!

';
 }
 else
 {
echo '

You are not welcome!

';
 }
?>

------解决方案--------------------
需要为input控件增加name属性,只有这样,浏览器才会把值提交到服务器
Username



Password
Related labels:
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