burge124 Posted April 12, 2008 Share Posted April 12, 2008 hi i have a mysql query that randomly prints a question & three possible answers, although i dont know how to assign each answer to a radio button... heres my code so far $result = mysql_query("SELECT * FROM question ORDER BY RAND() LIMIT 1"); while($row = mysql_fetch_array($result)) { echo $row['QuestionTitle']; echo "<br />"; echo $row['AnswerA']; echo "<br />"; echo $row['AnswerB']; echo "<br />"; echo $row['AnswerC']; echo "<br />"; } then the radio buttons consist of... <INPUT TYPE="RADIO" NAME="question2"VALUE="answer2.1">answera<BR> <INPUT TYPE="RADIO" NAME="question2"VALUE="answer2.2">answerb<BR> <INPUT TYPE="RADIO" NAME="question2" VALUE="answer2.3">answerc<br> thanks Link to comment https://forums.phpfreaks.com/topic/100839-assigning-data-from-a-query-to-radio-buttons/ Share on other sites More sharing options...
p2grace Posted April 12, 2008 Share Posted April 12, 2008 Are you trying to say that you don't know how to make the answera answerb etc from the db list next to the input button? If you are, you'd just save the data from the loop into a var, then below echo out that var. If this isn't what you're asking, could you be more specific? Thanks. Link to comment https://forums.phpfreaks.com/topic/100839-assigning-data-from-a-query-to-radio-buttons/#findComment-515738 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.