dealing with a quiz script, need to calculate results via php, having problems with searching $_POST's
<p>On this system a user can create a quiz of any number of questions, that info saves to a database. I'm using the below to output the quiz to the users. This outputs fine and you can only choose one of each answer. Each question has 3 inputs with the same post name, q1 has ans1 ans1 ans1, q2 has ans2ans2 ans2 etc... thats where the ".$x." comes in.</p>

<pre><code>    $x = 1;
    while($row = mysql_fetch_row($quiz)) {
        echo "Question ".$x.": ";
        echo "&lt;a&gt;&lt;b&gt; $row['question'] &lt;/b&gt;&lt;/a&gt;";
        echo "&lt;input type='radio' name='ans".$x." /&gt; ".$row['ans1']."&lt;br /&gt;";
        echo "&lt;input type='radio' name='ans".$x." /&gt; ".$row['ans2']."&lt;br /&gt;";
        echo "&lt;input type='radio' name='ans".$x." /&gt; ".$row['ans3']."&lt;br /&gt;";
        $x = $x + 1;
    }
</code></pre>

<p>The problem is in the next php page. I'm trying to loop through all posts and where the post matches the correct ans then result = result + 1. I need a loop that does something like this:</p>

<pre><code>$x = 1;
while($row = mysql_fetch_row($quiz)) {
    if ($_POST[ans[$x]]=='$row['correct']' { $result = $result + 1; 
    }
    $x = $x + 1;
    }
</code></pre>

<p>is there a way i can use a variable in that $_POST value to say ans1 ans2 for each loop?</p>
