Hi Anders, You can't send a header to the browser once output has been sent. The header() function should be before any other output on your script. Further more, because the script isn't terminated after the header() function, and you usually do not want to continue running it, an exit() should directly follow. e.g.: Header("Location: main.php"); exit();
Regards, Daniel Kushner _________________________________________ Need hosting? http://thehostingcompany.us > -----Original Message----- > From: Anders Mellstrom [mailto:[EMAIL PROTECTED]] > Sent: Friday, January 10, 2003 11:18 AM > To: [EMAIL PROTECTED] > Subject: [PHP] Header information ... > > > Hello. I can't get this code to work. The error message I get is > that the header could be added, cause it has allready been sent. > What shalll I do to get it to work? > > //Anders > > <html> > <head> > <title></title> > <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> > > <script language="JavaScript"> > if ((navigator.appName == "Netscape") && > (parseInt(navigator.appVersion) > 5)) > { > window.alert("Upgrade version of NS."); > } > else > { > document.write("<?php $i = 1 ?>"); > } > </script> > > <link rel='stylesheet' href='stil.css' type='text/css'> > </head> > <body> > > <br> > > <?php > if ($i == 1) > { > > Header("location:main.php"); > } > else > { > print("Byt webbläsare!"); > } > ?> > </body> > </html> > > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php