我正在使用codeigniter表单下拉列表。
add_store.php代码如下:-
<tr>
<td>country</td>
<td><?=form_input('country', set_value('country'));?></td>
<td class="error"><?php echo form_error('country'); ?></td>
</tr>
<tr>
<td><?=form_dropdown('Equipment',$options = array(
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6',
'7' => '7',
'8' => '8',
'9' => '9',
'10' => '10'));?></td>
</tr>
我将此表单添加到数据库中,它运行良好。
现在我想编辑这个页面。我正在做这样的事情:-
edit_store.php页面在这里
<tr>
<td>country</td>
<td><?=form_input('country', set_value('country', $store['country']));?></td>
<td class="error"><?php echo form_error('country'); ?></td>
</tr>
<tr>
<td>Equipment Rating</td>
<td><?=
$selected_Equipment = $this->input->post('Equipment');
form_dropdown('Equipment'$selected_Equipment);?></td>
// what i can do here, I am doing something wrong here??????????????????????????????????????????
</tr>
我的问题是:对于来自数据库的所选下拉列表,我能做什么?
如何编辑下拉选择的值?
那我该怎么办???
<?php
$selected_Equipment = '1';
$options = array(
'1' => '1',
'2' => '2',
'3' => '3',
'4' => '4',
'5' => '5',
'6' => '6',
'7' => '7',
'8' => '8',
'9' => '9',
'10' => '10');
form_dropdown('Equipment',$options,$selected_Equipment);
?>
希望这能有所帮助!
Kugutsumen是对的,form_dropdown函数的语法有点错误。你可以在这里看到它所包含的论点:http://codeigniter.com/user_guide/helpers/form_helper.html