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" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
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
| [EMAIL PROTECTED]
| 
| -- 
| 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

Reply via email to