BadOP
04-06-2006, 10:47 PM
I'm trying to write a color scheme chooser for my site and its not quite working. Baiscally there's 3 files, "css.php", "foot.php", and "scheme.php". I'm not sure what's going on because it looks correct, but it won't work correctly.
css.php (css.php is included with the include function in the head tags of every page that's part of the main site.):
<?
if (isset($_COOKIE['colorscheme'])) {
$scheme = $_COOKIE['colorscheme'];
if ($scheme = "blue") {
echo "<link href=\"css/blue.css\" rel=\"stylesheet\" type=\"text/css\">";
}
if ($scheme = "red") {
echo "<link href=\"css/red.css\" rel=\"stylesheet\" type=\"text/css\">";
}
}
else {
echo "<link href=\"css/blue.css\" rel=\"stylesheet\" type=\"text/css\">";
}
?>
foot.php:
<div align="center">
© Copyright 2006 BadOP.net<br>
<form method="post" action="scheme.php">
<select name="scheme">
<option name="blue" value="blue">Blue (Default)</option>
<option name="red" value="red">Red</option>
</select>
<input type="submit" name="scheme" value="Select"><br>
</form>
</div>
scheme.php:
<?
setcookie("colorscheme", $_POST['value'], time()+2678400, "/", "badop.net");
header("Location: http://badop.net/");
?>
css.php (css.php is included with the include function in the head tags of every page that's part of the main site.):
<?
if (isset($_COOKIE['colorscheme'])) {
$scheme = $_COOKIE['colorscheme'];
if ($scheme = "blue") {
echo "<link href=\"css/blue.css\" rel=\"stylesheet\" type=\"text/css\">";
}
if ($scheme = "red") {
echo "<link href=\"css/red.css\" rel=\"stylesheet\" type=\"text/css\">";
}
}
else {
echo "<link href=\"css/blue.css\" rel=\"stylesheet\" type=\"text/css\">";
}
?>
foot.php:
<div align="center">
© Copyright 2006 BadOP.net<br>
<form method="post" action="scheme.php">
<select name="scheme">
<option name="blue" value="blue">Blue (Default)</option>
<option name="red" value="red">Red</option>
</select>
<input type="submit" name="scheme" value="Select"><br>
</form>
</div>
scheme.php:
<?
setcookie("colorscheme", $_POST['value'], time()+2678400, "/", "badop.net");
header("Location: http://badop.net/");
?>