开发者

How to populate select box with the session values in CakePHP

开发者 https://www.devze.com 2023-02-16 23:27 出处:网络
I have stored many employee objects in session. how to populate the select box with the name of the all employees.i am v开发者_StackOverflow社区ery new to cakephp so explain me the syntax.Assuming tha

I have stored many employee objects in session. how to populate the select box with the name of the all employees.i am v开发者_StackOverflow社区ery new to cakephp so explain me the syntax.


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

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号