Thursday, November 27, 2008

Re: retrieve value of a "select" in the controller

Easiest way to check is load the page, view the source and see what
the element uses

ak form name="data[site][site_id] then use that to figure out what is
sent to $this->data

The other solution is throw

debug($this->data); in your controller to see whats in it.

Good luck

Sean

On Nov 26, 7:57 pm, pkclarke <paul.k.cla...@gmail.com> wrote:
> I have an uber-noob question:
>
> My view has a "select" that is not associated with any models:
>
>   echo $form->select('site_id', array('1'=>'Site 1', '2'=>'Site 2'),
> '1', array('id' =>'sites', 'label'=>'Site:'));
>
> How do I get the value of the "select" from the controller?  The most
> logic solution is:
>
>  $this->data['site_id']
>
> But that doesn't work.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "CakePHP" group.
To post to this group, send email to cake-php@googlegroups.com
To unsubscribe from this group, send email to cake-php+unsubscribe@googlegroups.com
For more options, visit this group at http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---

No comments: