How can I store data in session or cookie using jquery or JS and access it in php?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
For cookies:
JavaScript:
After that code has been run, and you open a page on the same domain with the following command in it:
PHP:
The output will be “The cookie “foo” had the value bar”.
For sessions:
You’re out of luck, that cannot be done on the client-side, so JavaScript won’t help you.