请告知我是否可以在发布html表单后以某种方式保留选择的单选按钮。这是一个调查问题和答案,其中数据来自db中每页的db页面字段。我知道我可以在每个页面帖子上将数据插入响应表中,然后在选择答案的地方检索它,但可能还有其他方法。 表单: “>
<input type="<?php
$submit = "";
if($page_id == 1 ) {
$submit = "hidden";
} else {
$submit = "submit";
}
echo $submit;
?>" name="Prev" value="<< Previous" id = "b1"
/>
<input type="<?php
$submit = "";
if($page_id == $max_page ) {
$submit = "hidden";
} else {
$submit = "submit";
}
echo $submit;
?>" name="Next" value="Next >>" id = "b2" />
<input type="<?php
$submit = "";
if($page_id <> $max_page ) {
$submit = "hidden";
... 来自DB的数据:
$question_set = find_all_question_by_survey_page($safe_survey_id, $safe_page_id );
while($question = mysqli_fetch_assoc($question_set)) {
$output .= "<li>";
$output .= urlencode($question["position"]);
$output .=". ";
$output .= wordwrap(htmlentities($question["question_text"]),110,"<br>\n ");
$output .="<br /><br />";
$answer_set = find_answers_for_question ($question["id"]);
$i = 0;
$output .= "<ul style=\"list-style: none;\">";
while($answer = mysqli_fetch_assoc($answer_set) and $i <= ( (int) urlencode($answer["position"]) -1 ) ) {
$output .= "<li>";
$output .= "<input type = \"Radio\" Name = "; //
$output .= urlencode($question['position']);
$output .= " value= ";
$output .= urlencode($answer["position"]);
$output .= " />";
$output .= " ";
$output .= $letters[$i];
$output .=") ";
$output .= wordwrap(htmlentities(mb_convert_encoding($answer["answer_text"], 'UTF-8', 'ASCII'), ENT_SUBSTITUTE, "UTF-8"),110,"<br>\n ");
$output .= "</li>";
$i++;
}
$output .= "</ul>";
...