我正在做一个在数据库中显示问题和答案的表单,现在我需要保存用户标记的答案。
我需要每个 RadioButton 的名称或选择下拉菜单。问题:我结合了 php 和 html,但我不知道如何传递单选按钮的名称或选择语法正确的下拉名称。单选按钮的答案名称是它们的 ID 以显示所有这些(RADIO17、Radio18、RADIO19、RADIOX...),现在我需要保存用户检查的单选按钮的特定 ID,例如 RADIO19。请帮忙。
<!--RADIO BUTTON-->
<div>
<label class="desc"name="question" value=" <?php $row_questionset['QuestionIDFKPK'];?>">
<?php echo $row_questionset['QuestionValue']; ?>
</label>
</div>
<?php while ($row_Answer=mysql_fetch_array($AnswersValue)){ ?>
<fieldset class="radios">
<label class="label_radio">
**<input name="RADIO<?= $row_Answer['AnswerIDPK'] ?>" value=" <?= $ValueIDradio=$row_Answer['AnswerIDPK'] ?>" type="radio" />**
<?php echo $row_Answer['AnswerValue']; ?>
</label>
<?php } ?>
</fieldset>
<!--INSERTING ANSWERS-->
<?php
$name=$_POST['RADIO1'];
if(isset($_POST['submit'])){
??????? -> $name=$_POST['RADIO$row_Answer['AnswerIDPK']'];
$query_AnswerSelected="SELECT * FROM tblanswer WHERE tblanswer.AnswerIDPK = '".$name."' ";
$AnswersValueSelected= mysql_query($query_AnswerSelected);
$row_AnswersValueSelected=mysql_fetch_array($AnswersValueSelected);
$Avalue= $row_AnswersValueSelected['AnswerValue'];
$useranswer= "INSERT INTO `nuevaspruebas`.`tbluseranswer` (`UserIDFKPK`, `AnswerIDFKPK`, `QuestionIDFK`, `AnswerValue`) VALUES ('$UserId','$name', '$QuestionID', '$Avalue')";
mysql_query($useranswer);
<?= $nameradio=$row_Answer['AnswerIDPK'] ?>;
}
?>
<!--INSERTING ANSWERS-->
<!--RADIO BUTTON-->
<?php } ?>