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

session_start();
if(isset($_SESSION['username']))
    {
    $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 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.