我遇到了单选按钮的问题,当我点击上一个按钮并且它没有提交到数据库时,它会自动清除。我无法将其与数据库中的答案相匹配。我也得到了按钮下一个按钮的相同问题。
enter code here
<div class="container question">
<div class="col-xs-12 col-sm-7 col-md-7 ">
<p>
Online exam
</p>
<hr>
<div class="well">
<div id="replace_question">
<form class="form-horizontal" role="form" id='login' method="post" action="result.php">
<?php
$number_question = $_POST['num_questions'];
$row = mysqli_query( $con, "select * from questions where category_id=$category ORDER BY RAND()");
$rowcount = mysqli_num_rows( $row );
$remainder = $rowcount/$number_question;
$i = 0;
$j = 1; $k = 1;
?>
<?php while ( $result = mysqli_fetch_array($row) ) {
if ( $i == 0) echo "<div class='cont' id='question_splitter_$j'>";?>
<div id='question<?php echo $k;?>' >
<p class='questions' id="qname<?php echo $j;?>"> <?php echo $k?>.<?php echo $result['question_name'];?></p>
<?php if (isset($result['answer1'])){?>
<input type="radio" value="1" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/><?php echo $result['answer1'];?>
<br/>
<?php }?>
<?php if(isset($result['answer2'])) {?>
<input type="radio" value="2" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/><?php echo $result['answer2'];?>
<br/>
<?php }?>
<?php if(isset($result['answer3'])){?>
<input type="radio" value="3" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/><?php echo $result['answer3'];?>
<br/>
<?php }?>
<?php if(isset($result['answer4'])){?>
<input type="radio" value="4" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/><?php echo $result['answer4'];?>
<br/>
<?php }?>
<input type="radio" checked='checked' style='display:none' value="5" id='radio1_<?php echo $result['id'];?>' name='<?php echo $result['id'];?>'/>
<br/>
</div>
<?php
break;
} ?>
</div>
</div>
</form>
<hr>
<input type="hidden" name="cur_ques_no" id="cur_ques_no" value="1">
<button id="1" class='previous btn btn-primary' type="button">Previous</button>
<button id="1" class="next btn btn-primary" type="button">Next</button>
</div>
</div>
</div>
如何解决此问题,请帮我解决以下代码。