Page 1 of 1

Multiple Choice php/mysql

Posted: Mon Jul 31, 2006 1:19 pm
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

Posted: Mon Jul 31, 2006 1:31 pm
by volka
What's the <lable>....</lable> element supposed to do?

Posted: Mon Jul 31, 2006 2:16 pm
by dandare
eep

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