Vinay
Vinay

Reputation: 75

How to populate select box with the session values in CakePHP

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.

Upvotes: 0

Views: 539

Answers (1)

vindia
vindia

Reputation: 1678

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.

Upvotes: 2

Related Questions