note 74544 added to function.setcookie
| From: | andy at isminc dot com | Date: | Mon, 16 Apr 2007 21:24:42 +0000 |
| Subject: | note 74544 added to function.setcookie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-125482@lists.php.net to get a copy of this message | ||
I've seen so many things involving setcookie and the location header... the workaround
I've found is to add an echo "\n"; - it looks like a cookie is only set if there is
content in the page
setcookie("test", 5);
header("Location: /");
- cookie is not set
setcookie("test", 5);
header("Location: /");
echo "\n";
- cookie is set
hope this helps
----
Server IP: 64.71.164.2
Probable Submitter: 71.225.64.55
----
Manual Page -- http://www.php.net/manual/en/function.setcookie.php
Edit -- https://master.php.net/note/edit/74544
Del: integrated -- https://master.php.net/note/delete/74544/integrated
Del: useless -- https://master.php.net/note/delete/74544/useless
Del: bad code -- https://master.php.net/note/delete/74544/bad+code
Del: spam -- https://master.php.net/note/delete/74544/spam
Del: non-english -- https://master.php.net/note/delete/74544/non-english
Del: in docs -- https://master.php.net/note/delete/74544/in+docs
Del: other reasons-- https://master.php.net/note/delete/74544
Reject -- https://master.php.net/note/reject/74544
Search -- https://master.php.net/manage/user-notes.php