<p>Take this code:</p>

<pre><code>&lt;?php
if (isset($_POST['action']) &amp;&amp; !empty($_POST['action'])) {
    $action = $_POST['action'];
}

if ($action) {
    echo $action;
}
else { 
    echo 'No variable';
}
?&gt;
</code></pre>

<p>And then access the file with ?action=test
Is there any way of preventing $action from automatically being declared by the GET? Other than of course adding</p>

<pre><code>&amp;&amp; !isset($_GET['action'])
</code></pre>

<p>Why would I want the variable to be declared for me?</p>

Check your php.ini for the
```
register_globals
```
setting. It is probably on, you want it off.
Why would I want the variable to be declared for me?
You don't.
It's a horrible security risk. It makes the Environment, GET, POST, Cookie and Server variables global
(PHP manual)
. These are a handful of
reserved variables
in PHP.