[FX.php List] Dynamic Value Lists

Kevin Futter kfutter at sbc.melb.catholic.edu.au
Sun Oct 23 17:05:27 MDT 2005

On 22/10/05 2:32 AM, "Peter Bates" <p.bates at sjcpl.org> wrote:

> Cool!
> Thanks Andy
> On Oct 21, 2005, at 10:56 AM, Andy Gaunt wrote:
>> Peter 
>> Add an option with a blank value and  the selected tag above your foreach
>> <select name="Title">
>>             <option value=²² selected></option>
>>             <?
>>     foreach($listResult['valueLists']['Title'] as $key=>$value) {
>>     ?>
>>             <option value="<?php echo $value; ?>"><?php echo $value;
>> ?></option>
>>             <?
>>     }
>>     ?>
>>           </select>
Apologies for sounding like a broken record, but as a web standards advocate
I feel obliged to let you know that an empty option element will invalidate
your HTML; you¹re better off, if your circumstance allows, using placeholder
text (something like ³Please Select² for example). This will still work with
Andy¹s solution, and is better for accessibility and usability reasons, as
well as being valid per spec.

(It constantly amazes me that people can learn to do fabulous, difficult and
technical things with tools like PHP, FM, XSLT etc, that require exacting
syntax and a considered approach, but still churn out tag soup when it comes
to the HTML.)

Sorry, off-topic rant over!

Kevin Futter
Webmaster, St. Bernard's College

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20051024/86c81af0/attachment.html

More information about the FX.php_List mailing list