Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 登录表单不工作_Php - Fatal编程技术网

Php 登录表单不工作

Php 登录表单不工作,php,Php,它给出了错误的结果。我使用Dreamweaver,刚开始学习PHP,我发现调试非常困难 </html> <head> <title>Login Form</title> </head> <body> <fieldset><legend>Login</legend> <form action="login.php" method="post" /><br/> Use

它给出了错误的结果。我使用Dreamweaver,刚开始学习PHP,我发现调试非常困难

</html>
<head>
<title>Login Form</title>
</head>

<body>
<fieldset><legend>Login</legend>
<form action="login.php" method="post" /><br/>
Username<input type="text" name="User" /><br/>
Password<input type="password" name="Pass" /><br/>
<input type="submit" value="submit" />
<input type="reset" value="clear"/>
</form>
</body>
</html>





<?php
$_user=$_POST["user"];
$_pass=$_POST["pass"];
if(($user=="hamza")&&($pass=="2"))
echo "Access Granted";
else echo "access denied";
?>

登录表单
登录

用户名
密码
应该是

if($_user=="hamza" && $_pass=="2")

$_user=$_POST["user"];
$_pass=$_POST["pass"];
应该是:

$_user=$_POST["User"];
$_pass=$_POST["Pass"];
案子很重要

为了能够一目了然地看到这样的错误:在本地(而不是在实时服务器上)启用
display\u errors
,并在php.ini中将
error\u reporting
设置为
E\u ALL
。这会让您注意到$user&$pass变量不存在

应该是

if($_user=="hamza" && $_pass=="2")

$_user=$_POST["user"];
$_pass=$_POST["pass"];
应该是:

$_user=$_POST["User"];
$_pass=$_POST["Pass"];
案子很重要


为了能够一目了然地看到这样的错误:在本地(而不是在实时服务器上)启用
display\u errors
,并在php.ini中将
error\u reporting
设置为
E\u ALL
。这会让您注意到$user&$pass变量不存在。

Dreamweaver。。。不是一个编译器…你得到了什么结果,你期望得到什么结果?没有任何PHP代码,就无法判断出什么是错误的。那么,它没有做什么呢?这一次可能得把我的水晶球拿出来。啊,PHP代码被OP&first EditorStreamweaver弄坏了。。。不是一个编译器…你得到了什么结果,你期望得到什么结果?没有任何PHP代码,就无法判断出什么是错误的。那么,它没有做什么呢?这一次我可能得把我的水晶球拿出来。啊,PHP代码被OP&first editorif弄乱了。你可以通过复制、粘贴和运行脚本来尝试一下。哇,案例很重要!将永远记住。:)对uif u竖起大拇指,请通过复制、粘贴和运行脚本来尝试。哇,案例很重要!将永远记住。:)为你竖起大拇指