Code Igniter - form_dropdown selecting correct value from the database

前端 未结 5 1357
傲寒
傲寒 2021-01-05 18:52

Im having a few problems with the form_dropdown function in CodeIgniter .... My application is in 2 parts, a user goes in, enters a form and submits it .... once its submitt

5条回答
  •  旧巷少年郎
    2021-01-05 19:50

    According to Codeigniter documentation

    The first parameter will contain the name of the field, the second parameter will contain an associative array of options, and the third parameter will contain the value you wish to be selected. You can also pass an array of multiple items through the third parameter, and CodeIgniter will create a multiple select for you.

    Your admin controller should have something like

    $data['selected'] = $this->salary_expectation->get_salary_selected();
    

    According to this, the admin view should be like this

    
    

提交回复
热议问题