Re: QF - Hierselect and associative arrays

From: Date: Sat, 21 Jan 2006 04:04:32 +0000
Subject: Re: QF - Hierselect and associative arrays
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-22631@lists.php.net to get a copy of this message
You could define globals that represent the equivalent ids for the 'friendly names' of the selected values...this way you never have to dig through your code if anything changes, it will all be kept in one place.....could be a separate include or something... adam On 1/20/06, Mark Steudel <mark@netriver.net> wrote: > > Is it possible to use associated arrays instead of regular arrays for > hierselects? > > Im trying to get the name of the select element like: > > <input type="select" name="member[numberofmembers]"> > > instead of > > <input type="select" name="member[0]"> > > I tried: > > $membershiptype['membershiptype'] = array( 'individual' => > 'Individual > Plan', > 'family' => 'Family Plan', > 'corporate' => 'Corporate Plan' ); > > $additional['numberofmembers'] = array( > 'family' => array( '1', '2', '3', > '4', '5' ), > 'corporate' => array( '1', '2', '3', > '4', '5', '6', '7', '8' ) ); > > $form = new HTML_QuickForm; > $sel =& $form->addElement('hierselect','member', 'Choose Plan: > ', > 'aidditional members'); > $options['member'] = array( $membershiptype['membershiptype'], > $additional['numberofmembers'] ); > > $sel->setOptions($options['member']); > $form->display(); > > Anyway may not be possible, thanks Mark > > -- Take care... Adam

« previous php.pear.general (#22631) next »