Re: Quickform select array

From: Date: Tue, 17 Jun 2003 14:01:13 +0000
Subject: Re: Quickform select array
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-6040@lists.php.net to get a copy of this message
Mike Carter wrote:
Hi, When using the Quickform 'select' element it would be nice if there was an option To make it automatically take the array values and use them for both the option label AND the option value in the HTML it outputs.
If I understood you correctly, you want to use an array like array('A', 'B', 'C') and to receive in output <option value="A">A</option> <option value="B">B</option> <option value="C">C</option> You can easily process your array like this: foreach ($ary as $item) {
    $aryAssoc[$item] = $item;
} and pass the resultant $aryAssoc to addElement(), no need to add special logic to HTML_QuickForm_select.

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