Using a multi-element like this:
$multi = new Zend_Form_Element_Multiselect('users'); $multi->setMultiOptions(array( //'option value' => 'option label' '21' => 'John Doe', '22' => 'Joe Schmoe', '23' => 'Foobar Bazbat' )); $form->addElement($multi);
You can get the values ββof an element as follows:
public function indexAction() { $form = new MyForm(); $request = $this->getRequest(); if ($request->isPost()) { if ($form->isValid($request->getPost())) { $values = $form->getValues(); $users = $values['users'];
$users will contain an array of values ββthat were selected:
array( 0 => '21', 1 => '23' )
Andrew
source share