I have set up a cookie in JavaScript to store the change to the stylesheet.

The cookie is loaded using

<body onload="set_style_from_cookie()">

This cookie was working fine until I set a session cookie in PHP to verity if a user was logged in

    $user = $_SESSION['username'];

This php code is placed at the top of the page. This has created a conflict with the JavaScript cookie. Is there anyway to get both cookies working together.

Recommended Answers

Cookies and Sessions are 2 different things: http://php.about.com/od/learnphp/qt/session_cookie.htm

Jump to Post

All 3 Replies

Cookies are the same for Javascript and PHP. There are no "PHP cookies" and no "Javascript cookies". Its all the same.

Just want to make sure you know that :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.