[FX.php List] Dynamic Value Lists

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

On 24/10/05 9:13 AM, "Andy Gaunt" <andy at fmpug.com> wrote:

> Kevin ­
> Your rant is well voiced. I use the options in my situations as you with a
> please select/specify/choose to avoid having invalid HTML code.
> I was just responding to Peter¹s request. Maybe a ³&nbsp;² would be better
> suited in the option tag to give a valid option. The value itself can of
> course be empty (or even put in ³The user did not make a choice² as the value)
> The better the standards of all developers here the better our clients,
> customers and business web sites will be.
> Andy Gaunt
> T: 407.810.4722
> andy at fmpug.com
> http://www.fmpug.com
Glad we agree Andy ­ my comments were certainly not aimed at you, but more a
general heads-up for anyone looking at your code, and perhaps for the
original poster to reconsider the empty option approach.

As you say, the value can be left empty, but I find it useful to have a top
option element that has something like ³Please Select² as visible text, with
something similar value. I can then loop through the POST array in PHP
looking for this value in order to catch where the user might have failed to
make a selection. Of course, this simply isn¹t an issue for forms where most
of the fields are optional.

Example code:

foreach($_POST as $key=>$value) {
        if ($value == strtolower("please select")) {
        $errorMsg = "You have neglected to make a selection somewhere.
Please try again.";
        } else {
    // submit data to FM via FX

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/47a1ff8e/attachment.html

More information about the FX.php_List mailing list