I will be descibing to similiar ways that you can change the background color of your website with php and leave it at that till the user changes it again. We are going to do this with CSS. You can either have your cSS info on your page or in a spereate document. The first thing youll have to do is decide if your going for the linked stylesheet or directly on your page. IF you link it you'll need to have this code in you <head> </head> tags.
CODE
<style type="text/css">
<?php include ("style.php") ?>
</style>
This isnt actualy real linking because i dont think you can link css stylesheets that end in .php. Anyways now were going to the read core of this thing. make your style.php file in the same folder where you have your index file or however you call it and put this code in it. <?php include ("style.php") ?>
</style>
CODE
/* CSS Document */
<?php
$colour=$_GET["bg"];
?>
body {
background:#<?php echo $colour ?>;
}
/* and any other style stuff you want to have */
<?php
$colour=$_GET["bg"];
?>
body {
background:#<?php echo $colour ?>;
}
/* and any other style stuff you want to have */
Now back to the page where you want the background changeing to go on. This is going to be the link that you have
CODE
<a href="?bg=000000">Black</a>
if you want a black background. now you can change 000000 to anyof the RGB color that we use in the web. The thing is right now the persons gonna go back to haveing white as their background color if they click any link other than that link for the balck background. so what your going to have to do is. Add a "&bg=<?php echo $bg; ?>" to the end of all of your links. that way it always tells it what the color for the background is. and you can also type in background colors into the url itself. so if you type in www.yoursite.com/index?bg=FF0000 your going to have a red background.
Now using this method you can change your whole color scheme of your website with one link and have your visitors choose how they like to have it, just remember to use diffrent variables each time. it could be a for background b for text color c for link colors and so on.
So then guys and gals. Happy Coding. If you have any question feel free to ask me and ill see if i can help.
And Merry Xmas and Happy New Year too. Wheee. hahaha

