i found the problem, it’s the very same i was talking about…
echo “You Are Registered And Can Now Login”;
$formUsername = $username;
header (‘location: Login.php’);
in the above piece of code from your script, there is an echo statement before the header(“Location:login.php”); line. There should not be any output before header(“Location”) statement.
Instead what you can do is…
header ('location: Login.php&user='.$username.'&status='fail');
here, when login fails, i am redirecting to the login page with two parameters one is user name and the other is login status as fail. so on the login page, you can catch these get parameters and display the error message accordingly.
again, there should not by any output before header statement.