Re: Cannot add header information - headers already sent
| From: | Marek Kilimajer | Date: | Wed, 13 Aug 2003 09:05:21 +0000 |
| Subject: | Re: Cannot add header information - headers already sent | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-159412@lists.php.net to get a copy of this message | ||
You need to rethink your code logic. Any headers, be it cookies, cookies from session_start(), header() calls, must be send before any content, content is what you can see if you select "view source" and comes from echo, print, printf, errors and warnings, or anything that is outside of <?php ?>. Or use output buffering.
frederik feys wrote:
Hi Marek, hi all, What do you mean by "says it all"? On that line the page title is outputted. I suspect something is wrong with the handler file: http://www.aurelis.org/store/checkout_form_handler.txt When i call http://www.aurelis.org/store/checkout_form.txt for step 1 (i.e. client personal register form) checkout_form gives no " headers already sent". When the client proceeds to step 2 (i.e. an overview of purchase) the checkout_form_handler file is called. This does some calculations, etc.. and then redirects user to proper page using an header(location:) call. I suspect this step gives the "header already sent". Any help appreciated! Fré -----Original Message----- From: Marek Kilimajer [mailto:kilimajer@webglobe.sk] Sent: dinsdag 12 augustus 2003 12:15 To: frederik feys Cc: php-general@lists.php.net Subject: Re: [PHP] Cannot add header information - headers already sent output started at /usr/local/www/vhosts/aurelis.org/htdocs/header_aurelis.php:95 says it all. Look into the file at line 95. frederik feys wrote:Hi all, I’m stuck with this one: I have an checkout procedure: when people come to the overviewpage(step2), they get: Warning: Cannot add header information - headers already sent by(outputstarted at /usr/local/www/vhosts/aurelis.org/htdocs/header_aurelis.php:95) in/usr/local/www/vhosts/aurelis.org/htdocs/store/includes/functions/get_cartID.php on line 14 header_aurelis.php is where actual html output starts (template) i had a similar problem in my cart. I solved this by adding at the top of my script: $cookie = GetCartId(); This doesn’t do the trick now :-( For your convenience i put the code here: http://www.aurelis.org/store/checkout_form.txt and a handler file: http://www.aurelis.org/store/checkout_form_handler.txt Can anyone shed some light on this? Thanks! Fré