I have a simple loginpage that shows a username and password login section and when the login button is pressed the form data gets sent back to the page for processing. If the data is valid and they`ve logged in successfully it directs them to a homepage, if not it shows them the login screen again and tells them what they did wrong (incorrect password, empty field, etc).
My problem is that for certain browsers (Chrome and Opera) the form needs to be submitted twice in order for the data to be set(Literally set, I've checked this using isset, empty & is_null checks).
I've read that there have been problems with this before on certain browsers (Chrome & IE), but the only other solution I found was to use javascript to pass the information instead. Is there anything I can do to make the form more "browser friendly"?
Update 1
Here's the form, its as basic as you can get, nothing special about it.
<form action="loginpage.php" method="POST">
Username: <input type="text" name="Username" autofocus="autofocus" />
<br/>
Password: <input type="password" name="Password" />
<br/>
<input type="submit" name="submit" />
</form>
Update 2
PHP Code
if (isset($_POST['submit']))
{
if ($_POST['Username']=="" || $_POST['Password']=="")
{
echo '<script type="text/javascript">';
echo "window.alert('You did not fill in a required field.')";
echo "</script>";
}
else
{
$username = $_POST['Username'];
$password = $_POST['Password'];
$sql = "SELECT * FROM Logins WHERE `Username` = '$username'";
$validate = mysql_query($sql);
while ($check = mysql_fetch_array($validate))
{
if ($password != $check['Password'])
{
echo "<script type='text/javascript'>";
echo "window.alert('password was incorrect.')";
echo "</script>";
}
else
{
header("Location: streaming/videosearch.php?order=dated&q=*");
}
}
}
}