无法得到post过来的值,该怎么解决
程序员文章站
2024-04-05 18:45:42
...
无法得到post过来的值
初学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 '
}
elseif($_POST['name']=='root'&&$_POST['password']=='123')
{
echo '
}
else
{
echo '
}
?>
------解决方案--------------------
需要为input控件增加name属性,只有这样,浏览器才会把值提交到服务器
初学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属性,只有这样,浏览器才会把值提交到服务器
上一篇: MySQL初始