Page 1 of 1

passing Javascript var to PHP

Posted: Thu Nov 21, 2002 2:35 pm
by PingLeeQuan
in java script, i am getting the cookie that was deposited by another script. If i find the cookie, i parse it to extract the "Access Level" from it. I am having difficulties in passing this value (Access Level) to the next PHP page even when i do the following:

tempvar="<input type=hidden name=mode value=" + AccessLevel + ">";
document.write(tempvar);

When i go to the next php page and try to access the variable mode, I get an error.

Thanks
quan

Posted: Fri Nov 22, 2002 1:52 am
by twigletmac
Are you putting that hidden field within a larger form or even just between <form> tags?

Mac

Posted: Fri Nov 22, 2002 7:44 am
by PingLeeQuan
thanks for your response.

yes.. and i am using document.location.href = 'AuthLogin.php'; after the fact that i am setting the AccessLevel

Posted: Fri Nov 22, 2002 9:15 am
by twigletmac
What's the error you receive when you try and access the information?

Mac

Posted: Fri Nov 22, 2002 11:11 am
by PingLeeQuan
twigletmac thanks again... I found the problem, the problem was it gave me the string name "AccessLevel" instead of the value. i was not escaping the appropriate quotes.

thanks a bunch
--quan :roll: