-1

I am looking to expand upon my PHP Knowledge, and have done some research on the internet. What I am trying to do is execute some code when a variable is set in the URL.

    if($_GET['variable']) && $_GET['variable'] = "something") {
        echo "Do This.";
    }

However, the code will still run regardless what variable is equal to, as long as it is set. How would I go about achieving mygoal?

Moonblaze
  • 163
  • 1
  • 11

1 Answers1

0

This should works :

if(isset($_GET['variable']) && $_GET['variable'] == "something") {
    echo "Do This.";
}
  • 1
    some added tid bits of information as to why it should work and why the OP's code failed in the first place, would be lovely. Enlighten everyone, and for future visitors. – Funk Forty Niner Aug 02 '15 at 21:40