[PHP] Accessing cookies in PHP and Javascript

2007-02-15 Thread Otto Wyss

Assuming I have a cookie

setcookie (username,$_SESSION['Username'], $expires);

how can I access the same cookie in Javascript? Or how do I have to 
create a cookies so it's accessable as


$_COOKIE[username]

O. Wyss

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] Accessing cookies in PHP and Javascript

2007-02-15 Thread Jon Anderson
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

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php