note 61167 deleted from function.setcookie by bjori
| From: | bjori@php.net | Date: | Mon, 08 Jan 2007 10:49:01 +0000 |
| Subject: | note 61167 deleted from function.setcookie by bjori | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-121431@lists.php.net to get a copy of this message | ||
Note Submitter: simplifiedwebsystems
----
I needed to access COOKIE data before the next page load, so here's the solution:
Accessing PHP $_COOKIE value before new page load or page refresh:
<?PHP
//Set the cookie and set the $_COOKIE value
//This works because $_COOKIE is a variable
setcookie('key', 'value', time()+60*60*24*30);
if (!isset($_COOKIE['key'])) {
$_COOKIE['key'] = 'value';
}
//The $_COOKIE['key'] = 'value' will now be available on this intantiation for
immediate use.
?>