title: Checking the correct answer from the database by a checked radio button in PHP
body: <p>I am creating an Online Assessment. I display all the questions randomly in a one page only. I have difficulty on how to check the correct answer in the database for checked radio button. I don't know what to do and the logic on how to do it.</p>
  
  <p>This is my php codes for displaying the questions randomly,</p>
  
  <pre><code>$view_questions=mysql_query("SELECT * FROM questions ORDER BY RAND()");
  </code></pre>
  
  <p>This is my html codes with php codes,</p>
  
  <pre><code>&lt;form name="" method="POST"&gt;
                  &lt;/br&gt;&lt;h4&gt;# of Questions&lt;/h4&gt;
                  &lt;?php
                  $i=1;
                      while($row=mysql_fetch_array($view_questions))
                      {
                  ?&gt;
                  &lt;div class="view_question fsize"&gt;
  
                      &lt;p align="justify"&gt;&lt;?php echo $i;?&gt;) &lt;?php echo $row['QUESTION'];?&gt;&lt;/p&gt;
                      &lt;div class="indent-question"&gt;
                          &lt;input type="radio" value="1" id="" name="radio[&lt;?php echo $row['QUESTION_NO'];?&gt;]"&gt; &lt;?php echo $row['ANSWER_1'];?&gt;
                          &lt;/br&gt;
                          &lt;input type="radio" value="2" id="" name="radio[&lt;?php echo $row['QUESTION_NO'];?&gt;]"&gt; &lt;?php echo $row['ANSWER_2'];?&gt;
                          &lt;/br&gt;
                          &lt;input type="radio" value="3" id="" name="radio[&lt;?php echo $row['QUESTION_NO'];?&gt;]"&gt; &lt;?php echo $row['ANSWER_3'];?&gt;
                          &lt;/br&gt;
                          &lt;input type="radio" value="4" id="" name="radio[&lt;?php echo $row['QUESTION_NO'];?&gt;]"&gt; &lt;?php echo $row['ANSWER_4'];?&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
                  &lt;?php
                  $i++;
                      }
                  ?&gt;
                  &lt;center&gt;&lt;button id='next&lt;?php echo $i;?&gt;' class='next btn btn-success' name="finish" type='submit'&gt;Finish&lt;/button&gt;&lt;/center&gt;
              &lt;/form&gt;
  </code></pre>
  
  <p>Table name: questions</p>
  
  <p>Table fields: QUESTION_NO, QUESTION, ANSWER_1, ANSWER_2, ANSWER_3, ANSWER_4, ANSWER</p>