note 61167 added to function.setcookie
| From: | simplifiedwebsystems at osu1 dot php dot net | Date: | Fri, 27 Jan 2006 06:36:58 +0000 |
| Subject: | note 61167 added to function.setcookie | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-102530@lists.php.net to get a copy of this message | ||
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.
?>
----
Server IP: 216.194.113.175
Probable Submitter: 67.20.205.172
----
Manual Page -- http://www.php.net/manual/en/function.setcookie.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+61167
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+61167&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+61167&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+61167&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+61167&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+61167&report=yes&reason=non-english
Delete: already in docs -- http://master.php.net/manage/user-notes.php?action=delete+61167&report=yes&reason=already+in+docs
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+61167&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+61167&report=yes
Search -- http://master.php.net/manage/user-notes.php