populate id from database in select box option value in zend framework -


hi new in zend framework want populate company name list database. have doen want populate id in option box

example

select option value='1'> tcs option

select

this code

application_form_clientcompanyform extends zend_form   $company_list = new application_model_clientcompany;          $showlist  = $company_list->companynamelist();          $list=array();         $id=array();                     foreach($showlist $key => $value)                          {                              $list[]=$value['companyname'];                               $id[]=$value['id'];                          }   $this->addelement('select', 'companyname', array(                         'required'   => true,             'filters'    => array('stringtrim'),             'style'    => array('width:103px'),              'multioptions' => $list,             'decorators'=>array(             'viewhelper','errors' 

but want set value in option in select box width $id database

$companyname = new zend_form_element_select('companyname'); $companyname->setrequired(true); $companyname->addfilter('stringtrim');         $company_list = new application_model_clientcompany;      $showlist  = $company_list->companynamelist();     //add selections multioption, assumes object...change notation if using array     foreach($showlist $company) {         $name = ucfirst($company->name);         $companyname->addmultioption($company->id, $name);     } $this->addelement($companyname); 

i know changed syntax style, find easier keep things straight way.

everything else may need in http://framework.zend.com/manual/1.12/en/zend.form.html, used using reference , the api framework, help.


Comments

Popular posts from this blog

.htaccess - First slash is removed after domain when entering a webpage in the browser -

Automatically create pages in phpfox -

c# - Farseer ContactListener is not working -