I am getting some information from the login page form.
When I press submit, it goes to a check-login.php
page where there it checks from the database if the credentials are correct or wrong.
Then it redirects to a track page.
My problem is that when I press submit on the log in page with the correct credentials.
It redirects to a white page.
And then, if I press refresh, it redirects to the correct page.
<div>
<h1>Login Form</h1>
<form action="check-login.php">
<input type="text" name="user" placeholder="user">
<input type="password" name="password" placeholder="password">
<input type="submit" value="log in">
</form>
</div>
This is the check-login php page
<?php
session_start();
$user=$_GET['user'];
$pass=$_GET['password'];
include("dblogin.php");
$sql="SELECT * FROM login";
$result=mysql_query($sql);
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
if($user==$row["username"] && $pass==$row["password"]){
$_SESSION["userid"]=$row["id"];
header ("Location: tracks.php");
}
}
if ($_SESSION["userid"]==""){
header ('Location: login.html?message=Wrong Username or Password');
}
?>