我使用数据库中的值填充多选表单。我想要做的是我想要根据我提供的数据选择一些值。我有我的代码从数据库语法错误填充多个select(select = true)表单
这里的语法错误是我的代码:
<?php
$des_pos_id = $_POST['des_pos'];
$test_tags = $_POST['test_tag_arr'];
$test_tag=explode(',',$test_tags);
$sql4 = "SELECT _id, score_type from test_category where sub_code='$des_pos_id'";
$sel4 = mysqli_query($connect,$sql4);
while($row4 = mysqli_fetch_assoc($sel4)){
$option1 .= '<option value = "'.$row4['_id'].'"'echo in_array($row4['_id'], $test_tag) ? 'selected="true"' : null;'>'.$row4['score_type'].'</option>';
}
$output = "<select name='test_tags[]' id='test_tags[]' multiple>";
$output .= $option1;
$output .= '</select> ';
echo $output;
exit;
?>
这里是错误消息:
语法错误,意想不到的 '回响'(T_ECHO)/应用程序/ XAMPP/xamppfiles/htdocs中/温度/ ESCO-测验/控制器/ script_controller.php
@GordonLinoff包括它。对不起,关于 –