1

I was writing in PHP and making so the page was declared by get method. For an example if it were index.php?page=home it would take home and compare to other strings and... ya include the home BUT the compression in the if statement dosnt work... I have also write that if get method == start then dont show the side news but it still showed it!

Here's my code:

if(isset($_GET['page']) && $_GET['page'] == 'start'){
    $adbool = false;
}else{
    include('inc/main.php');
}

And here is the if statement for deleting side news:

if(isset($adbool) && !$adbool == false){
    include('inc/ad.php');
}
2
  • When is the include of the side news allowed? When $adbool is true or false? Commented Nov 13, 2014 at 8:37
  • Use var_dump($_GET['page']) to display its actual value. BTW, replace if(isset($adbool) && !$adbool == false){ with if(isset($adbool) && $adbool){ Commented Nov 13, 2014 at 8:39

2 Answers 2

1

and remember this !$adbool == false is not equal to this $adbool != false

You better understand this part as well !$adbool == false; !$adbool means that $adbool is equal to false;

so !$adbool == false; means if false=false hence this condition always set to to true.

Thats why your logic is failing Change this

if(isset($adbool) && !$adbool == false){
    include('inc/ad.php');
}

To this

if($adbool == TRUE){//simply check weather its set to to true or not
    include('inc/ad.php');
}
Sign up to request clarification or add additional context in comments.

Comments

0

use

if(isset($adbool) && $adbool){
    include('inc/ad.php');
}

this will check if $adbool is set, and if it's set to true.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.