I have a simple JS script (below) that on click (of the element with an id of #addClass) adds a class (.switcher) to the body tag. The script uses jquery.
I would like to know if it's possible using PHP to store that info and keep it intact when the user moves on to the next page within the site (ie. the added class remains in place)? In fact the class needs to stay in place until the element with an id #removeClass has been clicked no matter how many pages the user chooses to browse through. Please be gentle with your responses - I'm not much of a coder!
<script type="text/javascript">
$("#addClass").click(function () {
$('body').addClass('switcher');
});
$("#removeClass").click(function () {
$('body').removeClass('switcher');
});
</script>
I am posting this on the PHP section of Daniweb following a response to this post (originally on the JS section)http://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/414040
Airshow mentions one solution might be possible using PHP $_session var. I don't know anything about PHP $_session var or how one would go about implementing it for my needs. I hope someone can help me out here...
Thanks
Daniel