0
私はクイズアプリケーションを設計していますが、私はwhileループを使ってクイズの質問とオプションをデータベースからロードしていますが、クイズの提出私は、ユーザーが選択したオプションを表示する方法を意味します。ユーザーが選択した後でPHPでクイズを処理する方法
私の質問は、ユーザーが選択した選択肢をどのように処理するかです。ここで
は、クイズの質問とオプションを表示するための私のコードです:
<?php $response = mysql_query("SELECT * FROM iq_questions ORDER BY RAND()"); ?>
<form method='POST' id='quiz_form'>
\t <?php
\t \t $counter = 0;
\t \t while($result = mysql_fetch_array($response)){
\t \t $counter = $counter + 1;
\t ?>
<div id="question_<?php echo $result['question_id'];?>" class='questions'>
\t <h4 id="question_<?php echo $result['question_id'];?>"><?php echo $counter.". ".$result['question_name'];?></h4>
\t <div class='align'>
\t <input type="radio" value="1" id='radio1_<?php echo $result['question_id'];?>' name='<?php echo $result['question_id'];?>'>
\t <label id='ans1_<?php echo $result['question_id'];?>' for='1'>A. <?php echo $result['choice1'];?></label><br/>
\t <input type="radio" value="2" id='radio2_<?php echo $result['question_id'];?>' name='<?php echo $result['question_id'];?>'>
\t <label id='ans2_<?php echo $result['question_id'];?>' for='1'>B. <?php echo $result['choice2'];?></label><br/>
\t <input type="radio" value="3" id='radio3_<?php echo $result['question_id'];?>' name='<?php echo $result['question_id'];?>'>
\t <label id='ans3_<?php echo $result['question_id'];?>' for='1'>C. <?php echo $result['choice3'];?></label>
\t <input type="radio" checked='checked' value="5" style='display:none' id='radio4_<?php echo $result['question_id'];?>' name='<?php echo $result['question_id'];?>'>
\t </div><br/>
</div>
<?php } ?>
<input type="button" id='next<?php echo $result['question_id'];?>' value='Next!' name='question' class='btn btn-success'/>
</form>
私は本当に助けを必要としてください。ありがとうございました。