JCBiggar
JCBiggar

Reputation: 2497

If URL equals anything with this, do this?

I have a some PHP on a website that changes information based upon what the URL equals for example:

?gw=hello http://mywebsite.com/?gw=hello

Then I have this div that I would like to hide with Php kinda like this. If ?gw= anything then the div is hidden.

My problem is, I have no clue how I can do that. If ?gw= is anywhere in the url, I want php to hide the div.

Hope my question makes sense! Thanks in advance for the help!

Upvotes: 0

Views: 204

Answers (2)

synan54
synan54

Reputation: 658

if (isset($_GET['gw'])){
    echo "<div>";
}

Upvotes: 0

NullPoiиteя
NullPoiиteя

Reputation: 57322

you can do this by using isset() and check that gw is set

if( isset($_GET['gw'] )){
  //hide the div.
}

you can write like

if( !isset($_GET['gw'] )){
  // your div code here 
  // so if gw is set it wont include 

}

Upvotes: 4

Related Questions