Done that and i know it works.
How do i know well if i add a 4th question and 3 answers i can retain the selected choice for question 4.
I'm streamlined the code after a reminder from
Allen McGrath
for($i=1;$i<$num_results+1;$i++)
{
$row = mysql_fetch_array($result);
$question_setup .= $row["question_copy"];
$question_setup .="<br>";
$SQL1 = "SELECT id,answer_copy FROM answers WHERE question_number = $i AND competition_number ='$this_competition_id'";
$result1 = mysql_query($SQL1);
$answer_results = mysql_num_rows($result1);
for($x=1;$x<($answer_results+1);$x++)
{
$row = mysql_fetch_array($result1);
$id = $row["id"];
$value = $row["answer_copy"];
switch($i)
{
case "1":
if($question_1 == $value)
{
$status ="checked";
}else{
$status ="";
}
$question_setup .="<input type=\"radio\" name=\"question_1\" value=\"$value\" $status>$value\n";
break;
case "2":
if($question_2 == $value)
{
$status ="checked";
}else{
$status ="";
}
$question_setup .="<input type=\"radio\" name=\"question_2\" value=\"$value\" $status>$value\n";
break;
case "3":
if($question_3 == $value)
{
$status ="checked";
}else{
$status ="";
}
$question_setup .="<input type=\"radio\" name=\"question_3\" value=\"$value\" $status>$value\n";
break;
}
}
It's still number 3 that is not keeping its value
TO see what i mean goto http://competitions.andbookonline.com
You'll see from the source ocde that it is working as it should
APART from question 3
Come on guys sure we all can't be incompident coders? :-P
Gary Mailer