To create select element in zend framework you have to create options list in database and bring that option to select menu.
If you are a select menu for country and its options is list of all countries then you will create country list in database and then will pull that list in select menu.
here is code for select menu that has list of countries.
 
$this->add(array(
            ‘type’ => ‘ZendFormElementSelect’,
            ‘name’ => ‘coutry’,
            ‘attributes’ => array(
                ‘id’ => ‘coutry‘,
            ),
            ‘options’ => array(
                ‘label’ => ‘Coutry:’,
                ’empty_option’ => ”,
                ‘value_options’ => @$arrSelectData[‘country’],
            ),
        ));
From above code arrselectData is array that brings list of countries from database.

 

Leave a Reply

Your email address will not be published. Required fields are marked *