Click to See Complete Forum and Search --> : Cookies


frei
January 3rd, 2003, 11:06 AM
I want to write the cookie-status of a browser into the variable $cookies using PHP and Javascript.

My solution is the following command, but it doesn't work :-((

echo "Cookie status:<script type='text/javascript'>if(navigator.cookieEnabled == 'true') {$cookies='allowed';}</script>".$cookies;

Does someone have an idea how to solve that problem? (the status must be in $cookies because I want to use it somewhere else in the code!)
:confused:

[Goodz13:Moved from Java Fourm]

serg_dz
January 8th, 2003, 06:24 AM
Your problem is that you are trying to combine server-side and client side code. You must remember that ALL php code will be parcesd on the server and than results willbe sent to clients browser. Browser will run javascript (if this option enabled). Browser has no idea that you are a php programmer.

Try evaluate all php code and see what you have.
You don't send information from clients computer to the server!
So php program don't know about javascript results.

--------------------
Sincerely,
Serg Dzysyak
AlarIT programmer
http://www.AlarIT.com