I am writing a php web application.
I want to set 2 values in a cookie with $_COOKIE.
The first value should be accessible to a javascript script.
But the second value must not be accessible to javascript scripts.
Is there a way to do that in PHP ?
Thanks
You need to write two separate cookies in the response to the browser, one with the HttpOnly attribute and one without.
See the set cookie documentation here for how to do it: