Forum Moderators: coopster
I am utilizing a css style switcher developed by another page but I have had to change some things to get it to work with my iframe. I wanted 1 style to use the iframe and then a text-based style that loads outside the iframe. I had everything working fine until I went to view the page on another pc.
The styler sets a cookie with the user's prefered style sheet and then displays the page. I figured out that I could read the cookie from the index.php file (iframe mode) and if the cookie was set with a specific value the page would redirect to the start of the text-based page. It works just fine as long as the cookie is set.
On the other pc I tried it on the cookie is *not* set yet and I've come across a problem. The page doesn't display at all! I've tried adding the setcookie() at the top of the cookie-checker but that has no affect.
<?php
if(isset($_COOKIE['mycookie'])){
$style = trim($_COOKIE['mycookie']);
if($style == "graphic_no"){
header("Location: http://my.web.site/textver.php");
exit;
}
else{
?>
display graphic ver html page
<?php
}
}
?>
I was thinking if there wasn't a cookie set at all then it would default to the graphic version, or if the user had the grahic version css selected that is stored in the cookie. Where am I going wrong?
<?php
if(isset($_COOKIE['mycookie'])){
$style = trim($_COOKIE['mycookie']);
if($style == "graphic_no"){
header("Location: [my.web.site...]
exit;
}}elseif(!isset($_COOKIE['mycookie'])){
?>
display graphic ver html page
<?php
}
?>