Multiple Choice php/mysql

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
dandare
Forum Commoner
Posts: 26
Joined: Wed Jul 26, 2006 7:56 am
Location: London

Multiple Choice php/mysql

Post by dandare »

Hi,

Need a little assitance please. The problem I am having is that when I test the code, the first answer is always selected and you cannot reselect any other option. I then added the first eight lines of code which you see and more or less the same thing happens.

Any ideas?

Code: Select all

$check0="";
$check1="";
$check2="";
$check3="";
if ($Q1== "'.$acA.'") { $check0 = "CHECKED"; }
if ($Q1== "'.$acB.'") { $check1 = "CHECKED"; }
if ($Q1== "'.$acC.'") { $check2 = "CHECKED"; }
if ($Q1== "'.$acD.'") { $check3 = "CHECKED"; }


echo ('<label><input type="radio" name="Q1" value="'.$acA.'">&nbsp;&nbsp;'.$answerA.'<br /> 
     <input type="radio" name="Q1" value="'.$acB.'">&nbsp;'.$answerB.'<br /> 
	 <input type="radio" name="Q1" value="'.$acC.'">&nbsp;'.$answerC.'<br /> 
	 <input type="radio" name="Q1" value="'.$acD.'">&nbsp;'.$answerD.'</label>');
Also another thing I wanted to know is firstly how to send the form and also whether I can enter a script that will send the correct answer as 1 and the wrong as 0.

something like:

Code: Select all

if ($Q1 == $acA) {

    SQ1=1

}else{

SQ1=0
Any help would be appreciated

Thanks
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

What's the <lable>....</lable> element supposed to do?
dandare
Forum Commoner
Posts: 26
Joined: Wed Jul 26, 2006 7:56 am
Location: London

Post by dandare »

eep

sorry - that was just me mucking around with styles sheet variations.
<label> does nothing
Post Reply