So I am using an if else statement for a login form and once you enter the correct login, it should redirect you to another HTML page, but if the information is incorrect, the page just refresh.

function myFunction() {

```
var email = document.getElementById("email").value;
var password = document.getElementById("password").value;

if(email == "admin@gmail.com" && password == "user")
{
    window.location.replace("upload.html");     

}
else {
   alert("Invalid information");
    return ;
}

```

}

---

```
    <form id="form" action="" method="GET">
        <div class="form-group">
          <label for="exampleInputEmail1">Email address</label>
          <input type="email"  id="email" class="form-control"  aria-describedby="emailHelp" >
          <small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
        </div>
        <div class="form-group">
          <label for="exampleInputPassword1">Password</label>
          <input type="password" id="password" class="form-control" >
        </div>
         <button type="submit" class="btn btn-outline-success btn-lg shadow" onClick="myFunction()">Submit</button>

      </form>

```