Jump to content

Recommended Posts

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)

Link to comment
https://forums.phpfreaks.com/topic/171575-solved-splash-truefalse/
Share on other sites

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.

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!";
}
?>

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!";
}
?>

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")

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.