Multiple Choice php/mysql
Posted: Mon Jul 31, 2006 1:19 pm
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?
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:
Any help would be appreciated
Thanks
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.'"> '.$answerA.'<br />
<input type="radio" name="Q1" value="'.$acB.'"> '.$answerB.'<br />
<input type="radio" name="Q1" value="'.$acC.'"> '.$answerC.'<br />
<input type="radio" name="Q1" value="'.$acD.'"> '.$answerD.'</label>');something like:
Code: Select all
if ($Q1 == $acA) {
SQ1=1
}else{
SQ1=0Thanks