(PHP) If statement stupidity -
this code checks if pin correct or not. code login/index page.
<!doctype html> <html> <h1> project_01 </h1> <h2> please enter access pin. </h2> <form action="checker.php" method="get"> <input type="text" name="pin"/> <input type="submit" value="submit"> </form> </html>
which works fine. code check if pin right turns blank page.
<!doctype html> <html> <p> <?php $enc = $get_["pin"]; if($enc == "7885") { echo ("user login."); elseif($enc == "5296"): echo ("admin login"); else: echo ("error."); } ?> </p> </html>
either prints out rest of code, or of if statements return true. why happen , how fix it?
this accidental typo, should changed from
$enc = $get_["pin"];
to
$enc = $_get["pin"];
also, better formatting brackets:
<?php $enc = $_get["pin"]; if($enc == "7885") { echo "user login."; } elseif ($enc == "5296") { echo "admin login"; } else { echo "error."; }
Comments
Post a Comment