Hi, I'm trying to forward to a URL after verifying a login.
First i'll check that the login and password is correct.
If it is correct i want to forward the user to a new URL. I'we tried Header("Location: http://www.bla.bla.url.com"); but then I got this error: Cannot add header information - headers already sent
My code: $result = mysql_query("SELECT * FROM user where username='$username' and password='$password' "); if (mysql_num_rows($result)) { $valid_user = $username; session_register("valid_user"); Header("Location: http://www.bla.bla.url.com"); } else { Echo ("Wrong username and/or password"); }
there must some output before header(...), perhaps a blank line outside the php braces? eliminate it.
if this happens, php automatically sends a html header that prevents the header() header to be sent.