How to populate select box with the session values in CakePHP

后端 未结 1 1572
星月不相逢
星月不相逢 2021-01-27 08:40

I have stored many employee objects in session. how to populate the select box with the name of the all employees.i am very new to cakephp so explain me the syntax.

相关标签:
1条回答
  • 2021-01-27 09:21

    Assuming that your employee objects in your session are in the following format array('Employee.id' => 'Employee.name') you can populate the selectbox with the following statement in your views: $this->Form->select('employees', $employees) (where $employees is an array formatted as above).

    See also http://book.cakephp.org/view/1430/select for more info on the syntax of the select box.

    0 讨论(0)
提交回复
热议问题