[snip] Hello all: 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"); if( ! headers_sent()) header("Location: http://somplaceelse.com"); ?> So I would expect this piece of code to direct me to somplace.com. However it does not, and I always end up at somplaceelse.com. I have done a tcpdump to assist with debugging here is the output below. From the look of it the first header is getting ignored all toghether. Is there some way to force changes I made to the headers, that will make headers_sent return TRUE? [/snip] First of all, let's not call something a bug unless we are pretty darn sure about it. Let's just call it a problem... Second, from http://www.php.net/headers_sent "You can't add any more header lines using the header() function once the header block has already been sent. Using this function you can at least prevent getting HTTP header related error messages. Another option is to use Output Buffering." Also, do those spaces exist in your code? If so you may want to change; if( ! headers_sent()) to if(!headers_sent()) HTH! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php