JQUERY
$('#myform').submit(function()
{
$.ajax(
{
type: "POST",
url: 'checkit.php',
data:
{
usernameuser: $("#usernameuser").val(),
passworduser: $("#passworduser").val()
},
success: function(html)
{
$(".gonewrong").html("");
$(".gonewrong").show();
$(".gonewrong").append(html);
}
});
});
});
LOGIN FORM
<form name="loginform" action="checkit.php" method="post" accept-charset="utf-8" id="myform">
<table class="logintable">
<tr class="logintr"><td class="mylabel">Username </td><td class="myinputfield"><input type="text" name="usernameuser" id="usernameuser"/></td></tr>
<tr class="logintr"><td class="mylabel">Password </td><td class="myinputfield"><input type="password" name="passworduser" id="passworduser"/></td></tr>
<tr class="logintrbutton"><td class="mylabel"> </td><td class="mybutton"><input type="submit" value="LOGIN" class="loginbutton" id="loginuser"/></td></tr>
<tr><td class="gonewrong" colspan="3"></td></tr>
</table>
</form>
CHECKIT.PHP
if ($numUsers>0)
{
session_start();
$_SESSION['username'] = $username;
header("Location: good.php");
}
else
{
echo 'Incorrect username/password';
}
If the login is wrong everything works fine, the message error is displayed in the right place but if the login was successful it doesn't redirect me to good.php in the address bar of the browser but i see that page (good.php) inside gonewrong.
I spent many hours on this and can't solve it.