Deepak Shrestha wrote:
> 
> Hi,
> 
> I am confused on how to populate the Select element from database. In
> the Select element I need to fill it with location data which is
> stored in database as single field table (each item is unique)
> 
> location
> --------------
> location1
> location2
> location3
> ...
> ... etc.
> --------------
> 
> There is very little stated in the documentation about
> "form->populate($data)" so I am confused on which goes where.
> 
> Can somebody illustrate its mechanics step by step conceptually? In
> particular when I pass the "$data" variable how do I access that in
> the form
> 
> 1. defined as global variable for this form class? OR
> 2. directly use that variable when creating form element? something like
> 
> ===========================================
> $location = New Zend_Form_Element_Select('adlocation');
> $location->setLabel('*Location:');
> foreach($data as $loc)
> {
>     $adlocation->addMultiOption($loc, $loc);
> }
> ===========================================
> 
> can somebody suggest me how to fill up this element?
> 
> 
> Thanks
> 
> 
> -- 
> =======================
> Registered Linux User #460714
> Currently Using Fedora 8, 10
> =======================
> 
> 

This might help,
http://peacocksuit.com/blog/2008/08/30/populate-a-zend_form-select-with-mysql-returned-data/

-- 
View this message in context: 
http://www.nabble.com/Populating-Zend_Form_Element_Select-from-database-example-tp21761696p21762105.html
Sent from the Zend Framework mailing list archive at Nabble.com.

Reply via email to