I have a site where the client wants to be able to select from a list, different color schemes. I have made this using css and have used php to select the different style sheets. This works great on the main page but the other 10 pages dont change. Im assuming that they arent finding the cookie or that the cookie ends when the user goes to another page in the site.
Heres the php code in the stand alone php page named set_style.php.
<?
import_request_variables("gP");
if ($GET[style]) {
setcookie("ai_style",$GET[style]);
}
header("Location: index.php");
?>
Heres the php on all the pages of the site:
<?
$my_style = $_COOKIE[ai_style];
if ( !$my_style ) {
$my_style = "aimain.css";
}
?>
<style type="text/css">
<!--
@import url("styles/<? echo $my_style ?>");
again this works on the main page only. I have the same code on all of the pages.
Heres the code that i use on the text links to pick the different color schemes which is only on the first page.
<a href="set_style.php?style=aired.css">Ai Red & Gray</a>
<a href="set_style.php?style=aimain.css"> Green Eggs & Ham</a>
Any help would be greatly appreciated.
thanks
douglas