I have the following code in a Zend form, creating a drop-down list fed from a database:
// ... previously create the array $list and fill it from database
$element = new Zend_Form_Element_Select('name');
$element->setLabel('List name')
->addMultiOptions($list);
$this->addElement($element, 'list_name', array(
'required' => true,
));
Question: how can I get the value after posting the form? With the above code, $post['name'] returns the index of the selected item. A detail: the html generated code shows that the content in the $list are assigned to each element as 'label=' and the 'value=' attribute is the index that I retrieve through $post. So I believe it's a matter of correctly defining the options of Zend_Form_Element_Select ...
Thanks