$count = mysqli_num_rows($result);
if($count == 1){
echo "<h1><center> Login successful </center></h1>";
} else{
echo "<script>alert('login failed! invalid username or password');</script>";
header("Location: index.php") ;
}
I want to display the alert message as login failed and if the user press ok then it should again go back to the login page.I tried above code but ,that doesn't work. the browser moves to the login page without showing the alert message. Is there any alternative ways for this?