The if(isset($_POST['next'])) isn't working, I can't seem to get it to work in any function, and I can't figure out why for the life of me
<p>I am really having a hard time figuring out why <code>if(isset($_POST['next']))</code> isn't working. How can I call something like that within a function?</p>

<pre><code>function questions($result){
    $options = array('A','B','C','D','E');
    echo "Please click 'Next'";
    echo "&lt;p class = 'button'&gt;&lt;input type='submit' name='next' value='Next'/&gt;&lt;/p&gt;";

    while($row = $result-&gt;fetch_assoc()){
        if(isset($_POST['next'])) {
            echo "&lt;h4&gt;".$row['question']."&lt;/h4&gt;";
            foreach($options as $option){
                $text = $row[$option];
                if($text)
                    echo "&lt;br/&gt;&lt;input type = 'radio' name = 'ans' value = '$option'&gt;".$text."&lt;br/&gt;";
            }
            echo "&lt;p class = 'button'&gt;&lt;input type='submit' id='submit' class = 'answer' name='submitAns' value='Submit' /&gt;&lt;/p&gt;";
            if(isset($_POST['submitAns'])){
                $answer = $row['answer'];
                if($_POST('ans') == $answer) { 
                    echo "&lt;h4&gt;Correct!&lt;/h4&gt;";
                } else {
                    echo "&lt;h4&gt;Incorrect. Correct answer is: ".$answer."&lt;/h4&gt;";
                }
                echo "&lt;p class = 'button'&gt;&lt;input type='submit' id='next' name='next' class = 'answer' value='Next' /&gt;&lt;/p&gt;";
            }
        }
    }
    if(isset($_POST['next'])){
        echo "End of questions for this exam";
    }
}
</code></pre>
