Jump to content

[SOLVED] IF statement errors


3mrys

Recommended Posts

Hiya,

 

I am having trouble with a very basic bit of PHP script.  I have more complex things working fine on my site, and i even use the script below to achieve the same result elsewhere.  Basically, i currently use the same script (apart from the variables) to show/hide a submenu depending on the section (s) the user is in as defined through the URL.  However, i am trying to apply this to an include statement, so that it does the same thing, if it is in a section then display it, otherwise hide it.

 

Above my head i have:

<?php

if ( $_GET["s"] == "" ) {

$s = "h";

} else {

$s = $_GET["s"];

}

?>

And the statement is:

<div <?php if ( $s == "h" ) { echo ''; } { echo 'class="noshow"'; } ?>><?php include ('modules/right/hh.php'); ?></div>

 

Basically, it keeps on outputting the no show class whatever section i am in or whether i place it in the THEN syntax or the ELSE part of the statement.  Which means my content isn't displaying.

 

Any help would be appreciated.

 

Thanks.

Link to comment
https://forums.phpfreaks.com/topic/85747-solved-if-statement-errors/
Share on other sites

Amazing, thankyou for your very quick reply.

 

I haven't a clue why the script wasn't working without the else seen as the menus are driven without a problem from the else part.  Either way it is now working, so thankyou very much.

 

If you want to see where this was implemented feel free:  www.diverse-enterprise.co.uk/index.php

 

Thanks again.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.