RE: [PHP] headers and cookies
| From: | Jay Blanchard | Date: | Tue, 29 Oct 2002 20:29:50 +0000 |
| Subject: | RE: [PHP] headers and cookies | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-121942@lists.php.net to get a copy of this message | ||
[snip]
I have one more than one occasion run into the problem of "headers already
sent" when I was using the header function in combination with cookies.
What is the right way of doing it?
<?php
header ( your thinggies here);
setcookie(blabal);
or the other way round? can I do php routines between these consecutive
calls for header and cookie?
I know that all headers must be sent before other output but what is the
catch here?
[/snip]
Well, if you send headers first you cannot send cookies, if you send cookies
first you cannot send headers. But you can use the ob functions to fix it.
Start here http://www.php.net/manual/en/function.ob-start.php
HTH!
Jay