I am working on creating a web application and have set up a login page using html. In the login page, the following script was placed and document.location.href = "\doctorhome.php"; is not working inside the if condition. The code redirects to doctorhome.php if I keep the code without a loop(but this does not validate the login info). Can someone please help me with this issue as this is the main thing blocking the completion of my project.
Javascript code I am using is provided below for reference:
<script>
function myFunction()
{
var x = document.getElementById("dname").value;
var y = document.getElementById("password").value;
if(x=="admin123"&&y=="root")
{
alert("Login successful");
document.location.href = "\doctorhome.php";
}
else
{
alert("Incorrect credentials");
}
}
</script>
Aucun commentaire:
Enregistrer un commentaire