PHP GET Question: How do I set a variable value only if it's not in the query string?
I know how to get the value from the query string if the parameter exists:

$hop = $_GET['hop'];

But I also need to set a default value IF it's not in the query string. I tried this and it didn't work:

$hop = $_GET['hop'];

if ($hop = " ") {
  $hop = 'hardvalue';
};

Please help me handle the case where the query string has and does not have the "hop" parameter, and if it's present but not defined:

example.com/?hop=xyz

&

example.com/

&

example.com/?hop=


Thank you!

Dustin

PS I don't know what I'm doing, so if you explain to me, please also include the exact code for me to add to my PHP page. Thanks!

PHP GET Question: How do I set a variable value only if it's not in the query string?
===

I know how to get the value from the query string if the parameter exists:

$hop = $_GET['hop'];

But I also need to set a default value IF it's not in the query string. I tried this and it didn't work:

$hop = $_GET['hop'];

if ($hop = " ") {
  $hop = 'hardvalue';
};

Please help me handle the case where the query string has and does not have the "hop" parameter, and if it's present but not defined:

example.com/?hop=xyz

&

example.com/

&

example.com/?hop=


Thank you!

Dustin

PS I don't know what I'm doing, so if you explain to me, please also include the exact code for me to add to my PHP page. Thanks!
