note 35107 rejected from function.setcookie by didou

From: Date: Mon, 22 Sep 2003 14:12:55 +0000
Subject: note 35107 rejected from function.setcookie by didou
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-56910@lists.php.net to get a copy of this message
Note Submitter: erik_neves@hotmail.com ---- The manual states that "cookies will not become visible until the next loading of a page that the cookie should be visible for", but there's a way around this that doesn't require a refresh. Just set the $_COOKIE variable right after you setcookie(). $lang = 'pt-br'; setcookie('lang', $lang); $_COOKIE['lang'] = $lang; The reason for this is that $_COOKIE is automatically set only when the page loads, but setting it explicitely makes the new cookie value available globally even for the same page that created it.

« previous php.notes (#56910) next »