variable scope work in 2 if statement
<p>In the second if function after request <code>anotherpost</code> <code>print $post</code> can't see anything, I read the manual and try<br>
1. <code>global $post = $_REQUEST['post'];</code> in getpost()<br>
or<br>
2. pass argument <code>return $post</code> in 1st <code>if</code> to <code>getpost($post)</code><br>
both not work, but is it the variable scope problem?</p>

<p>Thanks.</p>

<pre><code>//index.php
require 'test.php';
$test = new test();
$test-&gt;getpost();


//test.php
class test{
public function getform(){
    ....
    require 'form.php';
}

public function getpost(){
    $post = $_REQUEST['post'];
    if($_REQUEST['post']){
        print $post;
        require `form_anotherpost.php`;
    }
    if($_REQUEST['anotherpost']){
        print $post;
    }
}

//form.php
&lt;form&gt;
    &lt;input type="submit" name="post" value="post"&gt;
&lt;/form&gt;
//form_anotherpost.php
&lt;form&gt;
     &lt;input type="submit" name="anotherpost" value="anotherpost"&gt;
&lt;/form&gt;
</code></pre>
