phpwiz Posted August 24, 2009 Share Posted August 24, 2009 Ok, i am trying to make it so that if the user goes to index.php it looks somewhat like this... http://tpa-rpg.co.cc/index.php they click the splash and it goes to http://tpa-rpg.co.cc/index.php?Splash=False but if they go to ?Splash=True it shows the splash. can someone please tell me how to do this. (Keep in mind that i am a newb) Quote Link to comment https://forums.phpfreaks.com/topic/171575-solved-splash-truefalse/ Share on other sites More sharing options...
tekrscom Posted August 24, 2009 Share Posted August 24, 2009 if($_GET['Splash']) {// Do this if Splash = True}else{// Do this if Splash = False} Quote Link to comment https://forums.phpfreaks.com/topic/171575-solved-splash-truefalse/#findComment-904790 Share on other sites More sharing options...
phpwiz Posted August 24, 2009 Author Share Posted August 24, 2009 i didntreally understand that :/ Quote Link to comment https://forums.phpfreaks.com/topic/171575-solved-splash-truefalse/#findComment-904885 Share on other sites More sharing options...
Catfish Posted August 24, 2009 Share Posted August 24, 2009 ROFL <?php if ($_GET['Splash']) { // insert code to load the splash page } else { // insert code to load normal index.php } ?> if the variable 'Splash' is in the URL and is not set to FASLE it will load the splash page (true) otherwise it will load the index.php (false). You have ot put he code in to load either the splash or the index.php This is a really really basic fundamental of all programming languages. Quote Link to comment https://forums.phpfreaks.com/topic/171575-solved-splash-truefalse/#findComment-904995 Share on other sites More sharing options...
RichardRotterdam Posted August 24, 2009 Share Posted August 24, 2009 Check the manual for $_GET Quote Link to comment https://forums.phpfreaks.com/topic/171575-solved-splash-truefalse/#findComment-905009 Share on other sites More sharing options...
phpwiz Posted August 24, 2009 Author Share Posted August 24, 2009 Ok, i did what catfish told me to do and most of it works but when i put ?Splash=false it goes to the index page and when i put ?Splash=True it still goes to the same page? here is the code <?php if ($_GET['Splash']) { // insert code to load the splash page echo "you are not on the splash page!"; } else { // insert code to load normal index.php echo "Welcome to the splash page!"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/171575-solved-splash-truefalse/#findComment-905103 Share on other sites More sharing options...
mikesta707 Posted August 24, 2009 Share Posted August 24, 2009 thats because your get variable "splash" isn't a boolean value, its a string. the if statement will only run false if the get variable has a null value. try something like if ($_GET['Splash'] == "true") { // insert code to load the splash page echo "you are not on the splash page!"; } else { // insert code to load normal index.php echo "Welcome to the splash page!"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/171575-solved-splash-truefalse/#findComment-905113 Share on other sites More sharing options...
Catfish Posted August 24, 2009 Share Posted August 24, 2009 or if you want it to load the splash page even if Splash is set but not equal to true, you can use: if (isset($_GET['Splash']) && $_GET['Splash'] != FALSE) which will show the splash page unless Splash is not existing or Splash == FALSE. Quote Link to comment https://forums.phpfreaks.com/topic/171575-solved-splash-truefalse/#findComment-905230 Share on other sites More sharing options...
mikesta707 Posted August 24, 2009 Share Posted August 24, 2009 or if you want it to load the splash page even if Splash is set but not equal to true, you can use: if (isset($_GET['Splash']) && $_GET['Splash'] != FALSE) which will show the splash page unless Splash is not existing or Splash == FALSE. again, the get variable is a string, not a boolean value, so you will need to surround the value with quotation marks if (isset($_GET['Splash']) && $_GET['Splash'] != "FALSE") also, since it is a string you are comparing, the comparison operator will try to match the string exactly, so False, and faLse will make that if statement false. if you want to be able to compare any combination of upper and lower case letters to the string "FALSE" use the strtoupper function, and thigns like "false" "False" "falSe" etc. will be turned into FALSE and the if statement will run true. so if (isset($_GET['Splash']) && strtoupper($_GET['Splash']) != "FALSE") Quote Link to comment https://forums.phpfreaks.com/topic/171575-solved-splash-truefalse/#findComment-905237 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.