Why PHP isn't use the variable declared outside of POST?
<p>I need some help about how to pass a variable with POST without using sessions.</p>

<p>Currently my code doesn't display value of the variable called $myvariable:</p>

<pre><code>&lt;?php
if(isset($_POST['testbutton'])){
if ($_POST['testbutton'] == 'Testing') {

echo $myvariable;
var_dump($_POST);

}
}

$myvariable = "hello world";

echo '&lt;form action="'.htmlspecialchars($_SERVER["PHP_SELF"]).'" method="post"&gt;';
echo '&lt;input type="submit" value="Testing" name="testbutton"/&gt;';
echo '&lt;/form&gt;';

?&gt;
</code></pre>

<p>What should I change in the code to be able to use $variable in POST['testbutton'] part of the code ?</p>