我设法从下拉列表添加数据到数据库。我的问题是当我想编辑时,我无法看到数据库的值,我添加到下拉菜单中。我知道我的问题在于edit_class_view.php文件。如何在下拉菜单中设置数据库中的值?
这里是我的edit_class_view.php:
<div class="form-group">
<label class="control-label col-lg-2"> School Year-Semester:</label>
<div class="col-lg-4">
<?php
echo form_open('main/editClass');
$options = array(
'' => 'Select School Year and Semester',
'SY 2016-2017 2nd Sem' => 'SY 2016-2017 2nd Sem',
'SY 2017 Summer' => 'SY 2017 Summer',
'SY 2017-2018 1st Sem' => 'SY 2017-2018 1st Sem',
);
echo "<div class='drop_pos'>";
echo form_dropdown('sys', $options, 'class="btn dropdown-toggle"', 'required="required"', 'data-toggle="dropdown-menu"', '<?php echo $row->$School_Year_Semester;?>');
?>
<br>
<div class="text-danger"><?php echo form_error('sys');
</div>
</div>
</div>
</div>
笨的哪个版本? – Naincy