[FX.php List] Dynamic Value Lists
Peter Bates
p.bates at sjcpl.org
Sun Oct 23 17:24:48 MDT 2005
Kevin,
Admittedly I'm a newbie at php, but if I coded it like you suggested,
then either a user will never find anything when searching as there
would be no records that have "Please select" in any of the fields,
or else they will be required to always provide a selection in a field
(s) when they don't have to. Andy's answer works just like I want it
to, and it is proper for an empty value for database searching. Check
out this link to see what I mean: http://fmcwp.sjcpl.org/1875atlas/
Peter Bates
On Oct 23, 2005, at 6:05 PM, Kevin Futter wrote:
> 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
> http://www.sbc.melb.catholic.edu.au/
> _______________________________________________
> FX.php_List mailing list
> FX.php_List at mail.iviking.org
> http://www.iviking.org/mailman/listinfo/fx.php_list
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.iviking.org/pipermail/fx.php_list/attachments/20051023/3fa94c78/attachment-0001.html
More information about the FX.php_List
mailing list