vote-for-pedro Posted June 26, 2007 Share Posted June 26, 2007 Hi noob on the board here i hope someone can help me. im using cookies on my site they define what style sheet is to be used. only problem is until the user selects a style no cookie is made. im using this code to show a piece of flash. if(isset($_COOKIE['STYLE'])) { include($_COOKIE['STYLE'].'.php'); exit; } else { include("0.php") { i can use include($_COOKIE['STYLE'].'.php'); to show the flash if there is a cookie but other wise nothing will show up. include("0.php") will work on its own but the whole thing together wont work. im pretty sure ive made a simple mistake but i cant see it. ive also tryed using the include($_COOKIE['STYLE'].'.php'); break; default: require('0.php'); but no good either. Any advice? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
aim25 Posted June 26, 2007 Share Posted June 26, 2007 Well wat is 0.php? Quote Link to comment Share on other sites More sharing options...
Dragen Posted June 26, 2007 Share Posted June 26, 2007 That's a neater way of putting it. Saves on using the elseif's. If $_COOKIE['STYLE'] isn't set $style defaults to 0, so including $style should work fine. <?php $style = isset($_COOKIE['STYLE']) ? $_COOKIE['STYLE'] : '0'; include($style . '.php'); ?> Quote Link to comment Share on other sites More sharing options...
vote-for-pedro Posted June 26, 2007 Author Share Posted June 26, 2007 Dragen that worked great thanks for the promt reply what a great forum! Quote Link to comment Share on other sites More sharing options...
Dragen Posted June 26, 2007 Share Posted June 26, 2007 no problem.. I think it was thorpe.. or frost that pointed out that method of checking variables with isset. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.