romano2717 Posted February 19, 2008 Share Posted February 19, 2008 I need help to this problem that i've been tackling for quite a few days now.. see, I made a database driven quiz, wherein questions and choices are saved and retrieve in the database. the choices are displayed beside the radio button, there will be four radio buttons per question. the problem now is I dont know how to get the checked values of my radio buttons. I think i have something to change in my form with the way i name my form variables.. is there a way to display the checked values of the radio buttons? please i really need help.. cheers! heres the code. <?php session_start(); //connect to database include('connect.php'); //initz variables $made = $_SESSION['inst']; $topic = $_SESSION['topic']; $num = $_SESSION['num']; $sql = " SELECT * FROM questionnaires_table WHERE made = '".$made."' AND topic = '".$topic."' LIMIT $num"; $result = mysql_query($sql)or die("query failed, di mka fetch".mysql_error()); $count = mysql_num_rows($result); ?> <html> <head><title>OIPLT evaluation</title></head> <body> <?php echo '<form method="get" action="evaluate_score.php"> <table align = "center" border = "1" width = "75%">'; if($_GET['start']){ while($row = mysql_fetch_assoc($result)){ $a = $row['a']; $b = $row['b']; $c = $row['c']; $d = $row['d']; $ques = $row['ques']; $quesId = $row['quesId']; echo' <tr> <td align = "left"><b>'.$ques.'</b></td> </tr> <tr>'; echo" <td align = 'left'> <input type = 'radio' name=q$quesId value='$a'>{$a} </td> </tr>"; echo" <tr> <td align = 'left'> <input type = 'radio' name=q$quesId value='$b'>{$b} </td> </tr>"; echo " <tr> <td align = 'left'> <input type = 'radio' name=q$quesId value='$c'>{$c} </td> </tr>"; echo" <tr> <td align = 'left'> <input type = 'radio' name=q$quesId value='$d'>{$d} </td> </tr>"; } } echo " <tr> <td align='center'><input type='submit' name='sub' value='Finish'></td> </tr> </table>"; ?> </form> </body> </html> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.