Re: retrieving the label of an option element
| From: | Justin Patrin | Date: | Wed, 29 Jun 2005 16:29:09 +0000 |
| Subject: | Re: retrieving the label of an option element | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-19824@lists.php.net to get a copy of this message | ||
On 6/29/05, Cory Syvenky <csyvenky@gmail.com> wrote:
> Hi Gang,
>
> I'm using QuickForm to build a form that emails the data and also
> saves it to a MySQL database using MDB.
>
> I can retrieve the value submitted from my select list of US states,
> but I cannot retrieve the label. An example option looks like:
>
> <option value="11">Hawaii</option>
>
> I can grab the submitted value with:
>
> $stateID = htmlspecialchars($form->exportValue('slctState'));
>
> Instead I want to grab 'Hawaii', the text label for the option.
>
You can't. Labels are just that, labels. If the value means nothing to
you (i.e. you won't use it in anything else anyway) then just put the
label as the value as well.
--
Justin Patrin