Re: retrieving the label of an option element

From: Date: Wed, 29 Jun 2005 17:59:45 +0000
Subject: Re: retrieving the label of an option element
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-19827@lists.php.net to get a copy of this message
Thanks Justin. Are you kidding? Having the option value as the database key and human readable text as the label is one of the oldest methods in 'Ye Ole Book of Webdev', why else would HTML_QuickForm_select::loadQuery take the params that it does? I don't want to have to save redundant strings in the database for no good reason. IMHO, this is a serious weakness with the QuickForm lib. At least the .net framework allows you to access _anything_ that you could possibly want/need. These comments are not directed at you Justin, just thoughts coming out of my fingers... PS: Are you the same Justin that posts to the OpenZaurus list? cS On 6/29/05, Justin Patrin <papercrane@gmail.com> wrote: > 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 >

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