note 47786 deleted from function.setcookie by tularis
| From: | tularis@php.net | Date: | Sun, 02 Jan 2005 14:13:51 +0000 |
| Subject: | note 47786 deleted from function.setcookie by tularis | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-82572@lists.php.net to get a copy of this message | ||
Note Submitter: james at miicro dot net
----
With regard to refreshing a page after 0 seconds in order to allow the browser to 'see'
the cookie immediately (posted by brewthatistrue at plzYnoAspamHorOevilO dot com)...
It works, but bear in mind that if the user presses their Back button they will be sent back to the
same page (or if it's called from the same page, it will constantly reload). With such a short
time delay, they will probably be caught in a loop.
It's maybe better to write a function that sets the cookie to a variable which will be
accessible to the web page immediately, then the cookie will take effect on any future visits to the
page.
ie. something like
if($_POST["foo"]) {
$bar = $_POST["foo"];
} else {
$bar = $_COOKIE["foo"];
}