RE: [PHP] headers already sent and cookie problem
| From: | Ford, Mike [LSS] | Date: | Tue, 15 Jul 2003 09:35:40 +0000 |
| Subject: | RE: [PHP] headers already sent and cookie problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-155256@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: frederik feys [mailto:frederikfeys@pandora.be]
> Sent: 15 July 2003 09:45
>
> This is what i get:
> "Warning: Cannot add header information - headers already
> sent by (output started at /home/u/r/html/store/cart.php:188)
> in /home/u/r/html/store/includes/functions/get_cartID.php on line 14"
This says that on line 188 of store/cart.php you started outputting your HTML page, but you
can't do that before the attempt to send headers on line 14 of
store/includes/functions/get_cartID.php. Take a good look at line 188 of store/cart.php to see what
you can do so that it is not starting HTML output, or move the header calls above the point where it
is included/required.
> I know that the problem is the reading of the cookie and then
> after some sripting outputting page HTML.
No, other way around.
> I started my code
> ob_start()
> and do an ob_flush() within a function(show_cart) (?might
> that be a problem?)
Actually, that should be a preventer for the problem, so long as the ob_start() is executed before
output is started -- perhaps your ob_start() should occur earlier in your script?
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: m.ford@lmu.ac.uk
Tel: +44 113 283 2600 extn 4730 Fax: +44 113 283 3211