Using this code how can you make it only echo out the radio or checkbox if you have a b c d answers or a b answers. On my quiz its going to be a b c d and a (true) b (false) answers. To finish my quiz this is the only thing stopping me from finishing it. My question might not be to the point but I tried to get it ask close to what I did done. Thanks for any help.
<?php
//retreive questions from database and put into question box
$query2 = "SELECT `QuestionId`, `Question`, `Opt1`, `Opt2`, `Opt3`, `Opt4`,`Answer` FROM `pf_questions`";
$question2 = mysql_query($query2);
while($row = mysql_fetch_array($question2)){
$id = $row['QuestionId'];
$question = $row['Question'];
$opt1 = $row['Opt1'];
$opt2 = $row['Opt2'];
$opt3 = $row['Opt3'];
$opt4 = $row['Opt4'];
$answer = $row["Answer"];
?>
<div id="ContainerQuestion">
<span class="Question">Question <?php echo $id; ?>. <?php echo $question; ?></span>
<p><input type=radio name='q<?php echo $id; ?>' <?=( $answer == 'a')?("checked='checked'"):(""); ?> value="a"> <?php echo $opt1; ?> </p>
<p><input type=radio name='q<?php echo $id; ?>' <?=( $answer == 'b')?("checked='checked'"):(""); ?> value="b"> <?php echo $opt2; ?> </p>
<p><input type=radio name='q<?php echo $id; ?>' <?=( $answer == 'c')?("checked='checked'"):(""); ?> value="c"> <?php echo $opt3; ?> </p>
<p><input type=radio name='q<?php echo $id; ?>' <?=( $answer == 'd')?("checked='checked'"):(""); ?> value="d"> <?php echo $opt4; ?> </p>
</div>
<?php
}
?>