I have a problem :: help please?
| From: | Stevie D Peele | Date: | Sat, 20 Sep 2003 18:04:17 +0000 |
| Subject: | I have a problem :: help please? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-163299@lists.php.net to get a copy of this message | ||
I'm making my own style sheet switcher. Here's my problem. My style
switcher will switch the style once or twice, sometimes only once, and
then It will not do It again until the cookie expires, can somebody spot
what I am doing wrong?
-------form---action------------------------------
<?php
$value = $_POST['colors'];
$blue = "Royale Blue";
$teal = "Teal";
$green = "Hunter Green";
$maroon = "Maroon";
$grey = "Grey";
if ($value == $blue){
setcookie("blue",time()+3600);}
elseif ($value == $teal){
setcookie("teal",time()+3600);}
elseif ($value == $green){
setcookie("green",time()+3600);}
elseif ($value == $maroon){
setcookie("maroon",time()+3600);}
elseif ($value == $grey){
setcookie("grey",time()+3600);}
else
{
echo "Nothing isset!";
}
?>
<center><b><h3><font face="verdana"><?php echo $value ?> has
been
set!</h3><br><h5><a href="categories.php?cat=home">Click
Here</a> to
return back to the homepage!</h5>
</b></font></center>
-------------------------------------------------
and the cookie checker
-------------------------------------------------
<?php
echo "<link rel=stylesheet href=style.css type=text/css>";
if (isset($_COOKIE['blue'])){
echo "<link rel=stylesheet href=styleblue.css type=text/css>";}
elseif (isset($_COOKIE['teal'])){
echo "<link rel=stylesheet href=styleteal.css type=text/css>";}
elseif (isset($_COOKIE['green'])){
echo "<link rel=stylesheet href=stylegreen.css type=text/css>";}
elseif (isset($_COOKIE['maroon'])){
echo "<link rel=stylesheet href=stylemaroon.css type=text/css>";}
elseif (isset($_COOKIE['grey'])){
echo "<link rel=stylesheet href=stylegrey.css type=text/css>";}
?>
-------------------------------------------------
Thanks for everyones help......
Stevie