php - Login form is not working -


This gives the wrong result I use Dreamweaver and I have just started learning PHP, it is very difficult to debug me is.

  & lt; / Html & gt; & Lt; Top & gt; & Lt; Title & gt; Admission form & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Fieldset & gt; & Lt; Story & gt; Login & lt; / Narrative & gt; & Lt; Form action = "login.php" method = "post" /> gt; & Lt; Br / & gt; Username & lt; Input type = "text" name = "user" /> gt; & Lt; Br / & gt; Password & lt; Input type = "password" name = "pass" /> gt; & Lt; Br / & gt; & Lt; Input type = "submit" value = "submit" /> & Lt; Input type = "reset" value = "clear" /> & lt; / Form & gt; & Lt; / Body & gt; & Lt; / Html & gt; & Lt ;? Php $ _user = $ _ POST ["user"]; $ _pass = $ _ post ["passed"]; If ($ user == "cholera") & amp; ($ pass == "2")) "allowed to enter"; The second "Entrance denied" echo; ? & Gt;  

  if (($ user == "cholera") & amp; Amp;; ($ Pass == "2"))  

should be

  if ($ _ user == "cholera" & amp; $ _pass = "2")  

and

  $ _ user = $ _ POST ["user"]; $ _pass = $ _ post ["passed"];  

should be:

  $ _ user = $ _ POST ["user"]; $ _pass = $ _ post ["pass"];  

The case matters!

To be able to see such errors at a glance: Enable display_errors locally (not on live server) and in php.ini error_reporting Set to E_ALL . This will give you notice that the $ user & amp; $ Pass Variables were not in existence.


Comments