It may sound rather obvious, but don't send any header information :) The error you are getting means that you have echoed or printed something to the output, and have already started generating the HTML page. Don't do this. Jump into the php code straight away (no introductory HTML code) and test the conditions you want to test. Observe: <?php
if (user_and_pass_ok) { set a cookie or session var to log them in; header("Location: home.html"); } else { either print an error message OR; header("Location: login.html"); but not both. Print an error or redirect. } ?> > -----Original Message----- > From: Rodrigo San Martin [mailto:[EMAIL PROTECTED]] > Sent: 20 August 2002 07:46 > To: [EMAIL PROTECTED] > Subject: [PHP-WIN] Redirect > > > Halo. > > I need som help with my script. I need to find a way to redirect my script > to another file. I start with the login file, which is a html > file, and send > variables through it to a file I call do_login. This checks if > username and > password is correct. On the top of this file I have a if statement that > checks if the user has writen on the username and password box. > If not, they > get sent back to the login.html by a header("location:login.html"); > > Now, if username and password checks out i want to sent them to the start > page. The problem is the I already have sent header information > and cant use > Header() anymore. > > Can someone tell me an easy way to solve this problem > > Thanks... > > > > ------------------------------------------ > Rodrigo San Martin > Institutt for datateknologi og informatikk > > http://www.idi.ntnu.no/~rodrigo > > > > > -- > PHP Windows Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > > -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php