this is my problem i, ve create a drop-down list from table states ('id', 'state_name'), which is not my default model (which has many fields, one of the fields is the state in which I store states ('id '). so I used loadModel to populate the dropdown list. in my controller I used
$this->loadModel('State');
$this->set('states',$this->State->find('all'));
on the side of viewing
$form->select('State_id',$states);
the output displays the table name, the identifier and name are displayed.
when I printed $ state using pr (); I got
Array
(
[0] => Array
(
[State] => Array
(
[id] => 1
[state_name] => state1
)
)
[1] => Array
(
[State] => Array
(
[id] => 2
[state_name] => state2
)
)
etc.
how to create an array similar to an array (1 => state1, 2 => state2) from the specified array or is there another way to create a drop-down list
kind help