Re: Accessing cookies in PHP and Javascript

From: Date: Thu, 15 Feb 2007 22:51:47 +0000
Subject: Re: Accessing cookies in PHP and Javascript
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-248936@lists.php.net to get a copy of this message
Your favorite search engine would provide you with far better JavaScript answers than a PHP mailing list... Otto Wyss wrote:
Assuming I have a cookie setcookie ("username",$_SESSION['Username'], $expires); how can I access the same cookie in Javascript?
Parse out document.cookie.
Or how do I have to create a cookies so it's accessable as $_COOKIE["username"]
document.cookie = "username=" + escape(username); You can add expiry, path, etc. with JavaScript, but you can google for that. jon

« previous php.general (#248936) next »