In controller set
     $states = $this->State->find('list',array(
        'conditions' => array(
            'State.is_active = ' => 1
        ),'fields' =>array('State.id','State.name'), 'recursive' => -1));


    $this->set('states',$states);

and try in ur view


On Fri, Feb 12, 2010 at 7:48 AM, aveev <[email protected]> wrote:

>
> I want to get value from a table to be populated in drop down select in a
> form. Here's the table and the fields for example:
> States
> fields:id, name
> In add function in StatesController, I add this piece of code (as I learnt
> from the tutorial):
> $state = $this->State->find('list');
> $this->set('states',$state);
>
> and I add this code in my view:
> echo $form->select('state', array($states));
>
> when I debug the value of state drop down select, what I get is the id of
> state, not the name...what I want is the name, not the id..How can I do
> that
> ?
> Any help would be appreciated..
> Thanks...
>
>
> --
> View this message in context:
> http://old.nabble.com/Getting-values-from-drop-down-select-tp27557819p27557819.html
> Sent from the CakePHP mailing list archive at Nabble.com.
>
> Check out the new CakePHP Questions site http://cakeqs.org and help others
> with their CakePHP related questions.
>
> You received this message because you are subscribed to the Google Groups
> "CakePHP" group.
> To post to this group, send email to [email protected]
> To unsubscribe from this group, send email to
> [email protected]<cake-php%[email protected]>For
>  more options, visit this group at
> http://groups.google.com/group/cake-php?hl=en
>



-- 
(¨`·.·´¨)
 `·.¸(¨`·.·´¨)
`·.¸.·´          S.Annamalai

Check out the new CakePHP Questions site http://cakeqs.org and help others with 
their CakePHP related questions.

You received this message because you are subscribed to the Google Groups 
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php?hl=en

Reply via email to