> -----Original Message----- > From: James M. Luedke [mailto:[EMAIL PROTECTED] > Sent: 22 July 2003 07:07 > I am having a hard time with a small piece of code. I was > wondering > if someone may be able to explain why the following code will > not work... I > have been scratching my head for a few hours now and I am stumped. > > <?php > > header("Location: http://someplace.com");
At this point, you have specified that you want the header "Location: http://someplace.com" to be sent when headers are sent -- but headers are not sent until you output some actual content to your page. So... > if( ! headers_sent()) ... headers haven't been sent yet, so this test always triggers, so... > header("Location: http://somplaceelse.com"); ... this call always executes, specifying that, actually, you want *this* Location header to be sent when headers are sent, not the one specified before. I haven't the faintest idea what you might be trying to achieve here, but I think you need to rethink the logic of how you choose which redirect to use. Cheers! Mike --------------------------------------------------------------------- Mike Ford, Electronic Information Services Adviser, Learning Support Services, Learning & Information Services, JG125, James Graham Building, Leeds Metropolitan University, Beckett Park, LEEDS, LS6 3QS, United Kingdom Email: [EMAIL PROTECTED] Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php