Jump to content

[SOLVED] having more than one values for radio buttons on a page


Vidya_tr

Recommended Posts

I am developing a page for displaying a quiz.

I have a page which displays a set of questions and three answers as choices for a question with a radio button beside each option to choose the answer.

The radio buttons are generated dynamically while displaying the questions and their choices

 

But when trying to choose the answer for each question on the page,i am  able to check only a single radio button on the page.I am not able to check the radio buttons for each question.

After choosing an option for the 1st question,when I try to choose for the second , the radio button for the 1st question is unchecked.

the code for generating radio button is as follows..

$assign_questions=mysql_query("Select * from assign_questions where assignID=".$assignid."");
while($questions=mysql_fetch_array($assign_questions))
{
echo $questions['question_number'].")";
echo $questions['question_text']."<br>";


$assign_answers=mysql_query("Select * from assign_answers where assignID=".$assignid." and question_number=".$questions['question_number']."");
$x=1;

while($answers=mysql_fetch_array($assign_answers))
{	echo' <input name="choice[]" type="radio" value="'.$answers['answer'].'" />';
	echo $x++.".";
	echo $answers['answer']."<br>";

}

}

 

How can I avoid the problem of 'checked and unchecked' radio buttons???

Please help me...

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.