Milia Posted May 24, 2013 Share Posted May 24, 2013 I want to have a different include on a page according to the user's choice and if there is no choice, the date. The part with cookies to change the inclided php works, but the page is totally ignoring the date. I want it to be in that order, first considering if the user has made a choice and then if not, it will assign an include depending on the date. The choices are in order, I want the code to stop once it finds a choice that fits and just go with that, so I used "if else", as there can be more than one choice that is true, thus I thought it might not work with "switch case". Here's what I have, the cookies work, but the lines dealing with the date are ignored. I tried putting the day in a variable, but it didn't make a difference. <?php $thedays = date(d); if ($_COOKIE["confetti"] == "ver1") { include("axel7.php"); } else if ($_COOKIE["confetti"] == "ver2") { include("yuki7.php"); } else if ($_COOKIE["confetti"] == "ver3") { include("zel7.php"); } else if ($_COOKIE["confetti"] == "ver4") { include("yug3.php"); } else if ($thedays <= 7) { include("yug3.php"); } else if (($thedays >= && ($thedays <= 14 )) { include("axel7.php"); } else if (($thedays >= 15) && ($thedays <= 21)) { include("yuki7.php"); } else if ($thedays >= 22) { include("zel7.php"); } else { include("axel7.php"); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/278365-different-php-include-by-date/ Share on other sites More sharing options...
Jessica Posted May 24, 2013 Share Posted May 24, 2013 Turn on error reporting. It will tell you what is wrong. Compare your date() call to the examples in the manual. Quote Link to comment https://forums.phpfreaks.com/topic/278365-different-php-include-by-date/#findComment-1432141 Share on other sites More sharing options...
Milia Posted May 24, 2013 Author Share Posted May 24, 2013 I don't have access to that, I'm being hosted by a friend so I only have access to my folder and not to the control panel, etc. Manual? Can you see a mistake in the code? Quote Link to comment https://forums.phpfreaks.com/topic/278365-different-php-include-by-date/#findComment-1432142 Share on other sites More sharing options...
Jessica Posted May 25, 2013 Share Posted May 25, 2013 Yes. Quote Link to comment https://forums.phpfreaks.com/topic/278365-different-php-include-by-date/#findComment-1432183 Share on other sites More sharing options...
Milia Posted May 25, 2013 Author Share Posted May 25, 2013 Yes? Real helpful... -.- And what would it be? Quote Link to comment https://forums.phpfreaks.com/topic/278365-different-php-include-by-date/#findComment-1432265 Share on other sites More sharing options...
Solution Milia Posted May 25, 2013 Author Solution Share Posted May 25, 2013 Never mind, someone else solved it in a different forum. Quote Link to comment https://forums.phpfreaks.com/topic/278365-different-php-include-by-date/#findComment-1432269 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.