Re: newbie question about header()

From: Date: Mon, 22 Dec 2003 02:13:37 +0000
Subject: Re: newbie question about header()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-173122@lists.php.net to get a copy of this message
Unless you're using an 'if' statement, the header redirect must be the first line of the page, above any HTML markup. Jim www.websitemanagers.net ----- Original Message ----- From: "Scott Taylor" <scotttaylor@bigfoot.com> To: <php-general@lists.php.net> Sent: Sunday, December 21, 2003 8:04 PM Subject: [PHP] newbie question about header() | | | I am simply trying to redirect users from one page to another. Yet when | I use this code I get the following error: | | *Warning*: Cannot add header information - headers already sent by | (output started at | /usr/local/psa/home/vhosts/miningstocks.com/httpdocs/etc/php/login/admin/test.php:8) | in | */usr/local/psa/home/vhosts/miningstocks.com/httpdocs/etc/php/login/admin/test.php* | on line *9* | * | * | | <html> | <head> | </head> | | <body> | | <?php | header('Location: http://www.slashdot.org/'); /* Redirect browser */ | | /* Make sure that code below does not get executed when we redirect. */ | exit; | ?> | | </body> | </html> | | | | I know the workaround with the meta tag (<meta http-equiv="REFRESH" | content="0; URL=http://www.slashdot.org/">, but I just don't understand | what I am doing wrong here. I'm sure someone here knows.... | | Thank you in advance, | | Scott Taylor | scotttaylor@bigfoot.com | | -- | PHP General Mailing List (http://www.php.net/) | To unsubscribe, visit: http://www.php.net/unsub.php | |

« previous php.general (#173122) next »