how to post a looping value of radio button that have dynamics name?

chavezpeach

New Member
i tried to develop a system that allowing users to answer a quiz that will be generated randomly from a database. the problems now is to mark the quiz. how can i post value of radio button because it has different name.this is some of my code.thanks.\[code\]$selq="SELECT * FROM question WHERE q_subject_kod = '$subkod' AND q_chapter= '$chap' order by RAND() limit $bil "; $result=mysql_query($selq);?> <form name="quiz" action="mark.php?bil=<?php echo $bil?>&chap=<?php echo $chap?>&action=1&subject=<?php echo $subkod?>" method="post"><?php##Cycle through randomly selected questionsif (mysql_num_rows($result)>=0) {$qi = 1;$e=0?><table name="q" border="1" cellpadding="2" width="100%"><tr><td></td><td></td></tr><?phpwhile ($qry = mysql_fetch_array($result)) { $idsol=$qry['id']; $sol=$qry['q_quest']; $jwpn=$qry['q_ranws'];?><tr><td><?php echo $qi?></td> <td><?php echo $sol?></td></tr><tr><td></td><td>A<input type="radio" name="ans.<? echo $e?>" id="<? echo $idsol?>"value="http://stackoverflow.com/questions/3811714/<?php echo $qry['q_anws'];?>" /><?php echo $qry['q_anws'];?><br />B <input type="radio" name="ans.<? echo $e?>" id="<? echo $idsol?>" value="http://stackoverflow.com/questions/3811714/<?php echo $qry['q_anws1'];?>" /><?php echo $qry['q_anws1'];?><br />C <input type="radio" name="ans.<? echo $e?>" id="<? echo $idsol?>" value="http://stackoverflow.com/questions/3811714/<?php echo $qry['q_anws2'];?>" /><?php echo $qry['q_anws2'];?><br />D <input type="radio" name="ans.<? echo $e?>" id="<? echo $idsol?>" value="http://stackoverflow.com/questions/3811714/<?php echo $qry['q_anws3'];?>" /><?php echo $qry['q_anws3'];?><br /><input type="text" name="val.<? echo $idsol?>" value="http://stackoverflow.com/questions/3811714/<? echo $idsol?>"></td></tr><?php$qi++;$e++;}}}?>>\[/code\]
 
Back
Top