I have marked the thread resolved. For future reference, here is the solution:
setcss.php:
<?php
// Set CSS Stylesheet script
// Copyright (C) 2006 ThePeccavi
// Set cookie according to the $_GET['stylesheet'] variable
$stylesheet = $_GET['stylesheet'];
setcookie('stylesheet', $stylesheet, time()+31449600);
// Send the user back where they came from!
header('Location: ' . $_SERVER['HTTP_REFERER']);
// END!
?>
instead of the <link rel="stylesheet" etc.:
<?php
$stylesheet = $HTTP_COOKIE_VARS["ThePeccaviCSS"];
if (isset($stylesheet) && $stylesheet == 'dark') {
echo '<link type="text/css" rel="stylesheet" href="/dark.css" />';
}
// elseif(isset($stylesheet) && $stylesheet == 'value'){
// echo '<link rel="stylesheet" type="text/css" href="/file.css" />';
// }
// ^can be added as many times as you like!
else{
echo '<link type="text/css" rel="stylesheet" href="/default.css" />';
}
?>
Please respect my copyright
email me via my website (ThePeccavi.co.uk - click "Contact") if you would like to use it - all i want is to know that you are using it and that you have a footnote respecting my copyright - no money required, but if it's on offer... 😃
On my website I would like users to be able to choose between two different CSS sytlesheets (default.css and dark.css)
Can I do this using cookies? (My website is based around three php pages producing <infinity pages)
Thanks in advance
--Isaac