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

Link to comment
Share on other sites

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.