Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Radio button for my student test form
Old 08-03-2011, 08:58 PM Radio button for my student test form
Junior Talker

Posts: 1
Trades: 0
I'm running into the same problem while I'm building a test for some of my students. I'm pulling the questions from a database and I'm understanding how to do that, the part after that is what stumps me.

This is my code to get the questions from the database

$query = mysql_query("SELECT question, answer_a, answer_b, answer_c, answer_d, answer_e FROM t_questions");
while($row = mysql_fetch_assoc($query)){
echo $row['question']."<br />".$row['answer_a']."<br />".$row['answer_b']."<br />".$row['answer_c']."<br />".$row['answer_d'];
}


I'm not getting how to echo the results into a form with radio buttons. I appreciate your help.
cleecaldwell is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 08-04-2011, 07:47 AM Re: Radio button for my student test form
phazorRise's Avatar
Skilled Talker

Posts: 57
Name: Sachin Gutte
Trades: 0
PHP Code:
echo '<p>'.$row['question'].'</p>';
echo 
'<label><input type="radio" value="'.$row['answer_a'].'" name="'.$row['question'].'"/>'.$row['answer_a'].'</label>';
echo 
'<label><input type="radio" value="'.$row['answer_b'].'" name="'.$row['question'].'"/>'.$row['answer_b'].'</label>';
echo 
'<label><input type="radio" value="'.$row['answer_c'].'" name="'.$row['question'].'"/>'.$row['answer_c'].'</label>';
echo 
'<label><input type="radio" value="'.$row['answer_d'].'" name="'.$row['question'].'"/>'.$row['answer_d'].'</label>';
echo 
'<label><input type="radio" value="'.$row['answer_e'].'" name="'.$row['question'].'"/>'.$row['answer_e'].'</label>'
__________________
Make everything as simple as possible, but not simpler. — Albert Einstein

Please login or register to view this content. Registration is FREE
phazorRise is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Radio button for my student test form
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.41572 seconds with 12 queries