PHP Login Script help

Hello Experts,
I have just started creating a login script, but there seems to be something wrong with the code because the form is not being checked properly. What I am trying to do is that if the user enters info in the form it should say “OK.” otherwise it will say “Please enter your email address and Password.” I do not know why but even if I input some info, it says “Please enter your email and Password.” Please help me find the error. Thank You.

<?php if (isset($_POST['Email'])&& isset($_POST['Password'])) { $Email = $_POST['Email']; $Password = $_POST['Password']; $Password_hash = md5($Password); if (!empty($Email)&&!empty($Password_hash)) { echo "OK"; } else { echo "Please enter your Email and Password."; } } ?>

Echo Email and password_hash to check the value if it says that it is empty.

Add the form code as well.

And you have a problem here
[php]$Password_hash = md5($Password);[/php]

Please don’t use MD5 anymore. It might’ve been recommended 15 years ago, but definitly not any more.

Sponsor our Newsletter | Privacy Policy | Terms of Service