I am having great problem fixing this issue here and i am not very familiar with php. I don't see any problem missing in the code. I have searched and spent a really long time on this. However, it just keeps changing from one to another issue. the error that appears looks like this,
Undefined variable: password in /home2/abdi/public_html/phpinfo.php/login files/login.php on line 19
here is the actual code
<?php error_reporting(E_ALL); ini_set('display_errors', 1); session_start(); //connect to database $db=mysqli_connect("localhost","abdi_yae","abdi_yae123","abdi_ya"); if(isset($_POST['login_btn'])) { addslashes(trim($_POST['username'])); addslashes(trim($_POST['password'])); //$username=mysqli_real_escape_string($_POST['username']); // $password=mysqli_real_escape_string($_POST['password']); $password=md5($password); //Remember we hashed password before storing last time $sql="SELECT * FROM users WHERE username='$username' AND password='$password'"; $result=mysqli_query($db,$sql); if(mysqli_num_rows($result)==1) { $_SESSION['message']="You are now Logged In"; $_SESSION['username']= $username; header("location:home.php"); } else { $_SESSION['message']="Username and Password combiation incorrect"; } } ?>