我正在使用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>
我的问题是:我可以为选定的数据库下载做什么?
如何编辑下拉所选值?
那我该怎么办?
答案 0 :(得分:1)
<?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);
?>
希望这有帮助!
答案 1 :(得分:0)
Kugutsumen是对的,你的form_dropdown函数的语法有点不对。您可以在这里查看它并查看它所需的参数: http://codeigniter.com/user_guide/helpers/form_helper.html