hai*_*ets 4 php codeigniter codeigniter-form-helper
如何在codeigniter中的下拉列表中使用set_select()(表单助手的一部分):
它用于记住用户选择的选项.
$guide_options = array('investments' => 'Investments',
'wills' => 'Wills',
'tax-planning' => 'Tax planning',
'life-insurance' => 'Life insurance',
'currency-exchange' => 'Currency exchange',
'retirement-planning' => 'Retirement planning',
'international-healthcare' => 'International healthcare',
'savings-plans' => 'Savings plans',
'education-planning' => 'Education planning',
'sipps' => 'SIPPS',
'qrops' => 'QROPS',
'qnups' => 'QNUPS',
'mortgages' => 'Mortgages',
'other' => 'Other service'
);
echo form_dropdown('guide', $guide_options, 'investments');
Run Code Online (Sandbox Code Playgroud)
表格帮助指南:http://codeigniter.com/user_guide/helpers/form_helper.html
Kok*_*ers 12
set_select 如果您使用html代码生成而不是使用帮助程序,则可以使用.
虽然你可以做这样的事情
$selected = ($this->input->post('guide')) ? $this->input->post('guide') : 'investments';
echo form_dropdown('guide', $guide_options, $selected);
Run Code Online (Sandbox Code Playgroud)