not able to select options from radio buttons
Posted: Mon Apr 03, 2017 3:08 pm
hi there i have learned alot from this place need more help i am generating radio buttons through array while fetching data from mysql . ihave done that successfully but not able to select options among the questions this is mcq quiz which has three options and a question when i select option 1 from question 1 question 2 gets unselected can any one point that minor mistake
Code: Select all
$sql = 'SELECT * from question_1 ';
$result=mysqli_query($conn,$sql)
?>
<table width=10% cellspacing="1">
<?php while ($rows = mysqli_fetch_array($result)){ ?>
<label for="q1">Q1 <?php echo $rows['q1'];?>?</label><br>
<id= value="<?php echo $rows['q1'];?>">
<br>
<?php for($i=1; $i<=1; $i++)
{
?>
<?php for($i=1; $i<=1; $i++) {?>
<?php echo '<input type="radio" name="option30" id="$i" value="1">'; echo $rows['option1'].$i;?> <br>
<?php for($i=1; $i<=1; $i++)?>
<?php echo '<input type="radio" name="option31" id="$i" value="0">'; echo $rows['option2'].$i; ?> <br>
<?php for($i=1; $i<=1; $i++)?>
<?php echo '<input type="radio" name="option32" id="$i" value="2">'; echo $rows['option3'].$i; ?> <br>
<br>
<?php
}
?>
<?php
}
?>
<?php }?>
<?php //endwhile;
?>
<?php mysqli_close($conn); ?>