如何突出每个问题的状态是否回答

I am working on an quiz page.In this there are radio buttons corresponding to each question.I have to view the status of each question whether answered or not.please give me any solution to do this.

here is my code

  <?php 
 error_reporting(E_ALL ^ E_DEPRECATED);
$rs=mysql_query("select * from question where testid=$tid order by quesid ",$cn) or die(mysql_error());

if($_SESSION[qn]>mysql_num_rows($rs)-1)
{
unset($_SESSION[qn]);
echo "<h1 class=\"head1\">Some Error  Occured</h1>";
session_destroy();
echo "Please <a href=\"UserHome.php\"> Start Again</a>";

exit;
}
        ?>
        <form name="myfm" id="myfm" method="post" action="QuizSub.php">
        <table width="100%">  
        <?php
        $n=0;
        while($row= mysql_fetch_row($rs)){?>

        <tr> <td width="30"></td><td></td></tr> 
        <?php $n=$n+1; ?>
        <tr><td>Question <?php echo $n.") ".$row[2]; ?></td></tr>
    <tr><td class="style8">A. <input type="radio" name="ques<?php echo $n; ?>[]" value="1"><?php echo $row[3]; ?></td></tr>
    <tr><td class="style8">B. <input type="radio" name="ques<?php echo $n; ?>[]" value="2"><?php echo $row[4];?></td></tr>
    <tr><td class="style8">C. <input type="radio" name="ques<?php echo $n; ?>[]"  value="3"><?php echo $row[5];?></td></tr>
    <tr><td class="style8">D. <input type="radio" name="ques<?php echo $n; ?>[]"  value="4"><?php echo $row[6];?></td></tr>

    <?php 
        }
        echo "<tr><td><input type=\"hidden\" name=\"qncount\" id=\"qncount\" value=\"".$n."\"><input type=\"submit\" name=\"submit\" id=\"result\" value=\"Get Result\"></td></tr>";
        ?>
        </table>
        </form>

If you're trying to stop people from submitting unchecked question answers - in your case - the easiest thing to do is for every answer: make one checked by default.

<input type="radio" checked />

For unattended radio buttons, target the name you're using ie:

<form method="post">
<input type="radio" value="1" name="example">
</form>

and then POST it to a PHP file. You can then check if its unattended by doing:

<?php
if(!isset($_POST['example'])): // ! represents NOT
    // do something
endif;
<?php 
 error_reporting(E_ALL ^ E_DEPRECATED);
$rs=mysql_query("select * from question where testid=$tid order by quesid ",$cn) or die(mysql_error());

if($_SESSION[qn]>mysql_num_rows($rs)-1)
{
unset($_SESSION[qn]);
echo "<h1 class=\"head1\">Some Error  Occured</h1>";
session_destroy();
echo "Please <a href=\"UserHome.php\"> Start Again</a>";

exit;
}
        ?>
        <form name="myfm" id="myfm" method="post" action="QuizSub.php">
        <table width="100%">  
        <?php
        $n=0;
        while($row= mysql_fetch_row($rs)){?>

        <tr> <td width="30"></td><td></td></tr> 
        <?php $n=$n+1; ?>
        <tr><td>Question <?php echo $n.") ".$row[2]; ?></td></tr>
    <tr><td class="style8">A. <input type="radio" name="ques<?php echo $n; ?>[]" value="1"><?php echo $row[3]; ?></td></tr>
    <tr><td class="style8">B. <input type="radio" name="ques<?php echo $n; ?>[]" value="2"><?php echo $row[4];?></td></tr>
    <tr><td class="style8">C. <input type="radio" name="ques<?php echo $n; ?>[]"  value="3"><?php echo $row[5];?></td></tr>
    <tr><td class="style8">D. <input type="radio" name="ques<?php echo $n; ?>[]"  value="4"><?php echo $row[6];?></td></tr>

    <?php 
        }
        echo "<tr><td><input type=\"hidden\" name=\"qncount\" id=\"qncount\" value=\"".$n."\"><input type=\"submit\" name=\"submit\" id=\"result\" value=\"Get Result\"></td></tr>";
        ?>
        </table>
        </form>

Save QuizSub.php as Follows

<?php  
if($_SERVER['REQUEST_METHOD'] == 'POST' && $_POST['submit'] == "Get Result")
{

    if(ctype_digit($_POST['qncount']) && $_POST['qncount'] > 0)
    {
        for($i=1;$i<=$_POST['qncount'];$i++)
        {
            if(isset($_POST['ques'.$i]))
                echo "Q".$i." is answered and the answer is".$_POST['ques'.$i][0] ;
            else
                echo "Q".$i." is not answered" ;

            echo "<br/>";
        }   
    }
    else
    {
        echo "Questions are empty";
        exit;
    }

}
?>

Try this :

function checkAnsweredOrNot() {
    var radioButtons = document.myfm.radioGroupName;
    var answered;

    for(var i=0; i<radioButtons.length; i++) {
        if( radioButtons[i].checked ) {
            answered = true;
            break;
        }
    }
    answered = false;
};