maxarbos wrote: > Hello, > > i am building a zend_form that has a select box in it. > > The values for the select box come from an array such as: > array( 'a' => 'First', 'b' => 'Two'); > > I want the values and the visible label of the select box to be the values > of the array such as: > > <option value="First">First</option> > <option value="Two">Two</option> > > Is there an option or flag to set wen building the select box element to do > this, or do I need to iterate through the array and create a new one with > the values as the key? > > Thanks. > >
No need to iterate through the array, you can get the array you want by:
$arr = array('a' => 'First', 'b' => 'Second');
$arr2 = array_combine($arr, $arr);
But no, I don't think there is an option on the select box.
signature.asc
Description: OpenPGP digital signature
