我有一个测验,一个测验有多个复选框问题。如何使所有复选框名称不同,以便我可以正确检索?
HTML:
foreach($questionSetArr as $question){
$questionID = $question['question_id'];
$getListOfOptions = getOptionsList($questionID);
foreach($getListOfOptions as $option){
$optionDesc = $option['option_desc'];
echo "<div class='checkbox'>
<label><input type='checkbox' value='$optionDesc' name='cb[$questionID]' id='$questionID' >$optionDesc</label>
</div>";
}
}
PHP:
$questionID = $qIDArr[$x];
echo "<br>User Answer for Question $questionID : ";
$selectedQuestion= $_POST["cb"];
print_r($selectedQuestion);
foreach ($selectedQuestion as $sQ){
echo $sQ;
}
答案 0 :(得分:0)
尝试这样命名:
名=&#39; CB [$ questionID] []&#39;