Kan*_*iya 5 php validation codeigniter codeigniter-form-helper
嗨我正在使用codeigniter,我想添加multi select box到我的页面,
我看到了codeigniter用户指南示例,但它正在做的是在多选中设置值.
像这样
$options = array(
'small' => 'Small Shirt',
'med' => 'Medium Shirt',
'large' => 'Large Shirt',
'xlarge' => 'Extra Large Shirt',
);
$shirts_on_sale = array('small', 'large');
echo form_dropdown('shirts', $options, $shirts_on_sale);
Run Code Online (Sandbox Code Playgroud)
在这个像这样创建的多选框中
<select name="shirts" multiple="multiple">
<option value="small" selected="selected">Small Shirt</option>
<option value="med">Medium Shirt</option>
<option value="large" selected="selected">Large Shirt</option>
<option value="xlarge">Extra Large Shirt</option>
</select>
Run Code Online (Sandbox Code Playgroud)
它必须给出在$shirts_on_sale数组中选择的选项 ,但在我的情况下,我想创建一个多选,但dont want selected options 我试图传递一个空数组.但它不起作用
像这样
$array = array();
echo form_dropdown('shirts', $substore_details, $array);
Run Code Online (Sandbox Code Playgroud)
如何创建没有选定项目的多项选择.请帮忙..............
您应该使用form_multiselect()帮助器.
$options = array(
'small' => 'Small Shirt',
'med' => 'Medium Shirt',
'large' => 'Large Shirt',
'xlarge' => 'Extra Large Shirt',
);
echo form_multiselect('shirts', $options);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
18976 次 |
| 最近记录: |