Re: building html form select menus from arrays in php

Top Page
Attachments:
Message as email
+ (text/plain)
+ PGP.sig (application/pgp-signature)
Delete this message
Reply to this message
Author: June Tate
Date:  
To: plug-discuss
Subject: Re: building html form select menus from arrays in php
On Mar 6, 2005, at 9:15 PM, Craig White wrote:
>> On my setup, it seems to work, but without displaying any labels. Your
>> values are there, but you're not giving a human-readable name for each
>> option in the select list. As a result, it shows up as a blank list.
>>
>> Change your <option> HTML to read the following:
>>
>>     echo '<OPTION>'. $picklist[$x] .'</OPTION>';

>>
>> And it should display a list the way you're wanting. The value
>> attribute is only used for enumerated lists where you are mapping
>> human-readable values to database values (i.e., phone call result
>> codes). If you don't specify a value attribute, the browser will use
>> the value between the <option></option> tags as the actual value.
> ----
> OK - got it...thanks
>
> spent a lot of time working on this issue - finally reduced it down to
> something really simple to ask the question which solved most of my
> problems but you finished it.
>
> I guess that is a technique that I need to get through my thick
> head...keep it simple.


Well, this issue had little to do with overcomplexity -- more like you
just didn't understand what values to give to the <option> tag.

Even as a seasoned web coder, I find myself fighting with HTML and it's
various nuances, so the HTML specifications are always a handy
reference. So, when in doubt, look in the HTML specs. =o)

--
June Tate * http://www.theonelab.com *