|
Posted by Jonathan N. Little on 07/07/06 13:34
Toby Inkster wrote:
> Jonathan N. Little wrote:
>
>> Two things. One, you did not quote, tsk-tsk. Two, you missed everyone's
>> point, a SELECT element with *no* OPTIONS is invalid and makes no sense.
>> If that situation occurs you should not create the SELECT but instead
>> some indication that no options exist...
>
> My favourite way of doing this (in PHP) is:
One slight modification I would make, although a value between the
OPTION tags should become the value default value for the OPTION element
if there is no VALUE attribute, IE will not parse it when you try to
access the value via JavaScript, so I would explicitly set the VALUE
attribute
>
> <?php
>
> $started = FALSE;
> while ($data = pg_fetch_array($results))
> {
> if (!$started)
> {
> print "<select blah blah blah>\n";
> $started = TRUE;
> }
> //printf("\t<option>%s</option>\n", htmlentities($data['option']));
$v = htmlentities($data['option']);
printf("\t<option value=\"%s\">%s</option>\n", $v, $v);
> }
> if ($started)
> print "</select>\n";
>
> unset($started);
>
> ?>
>
--
Take care,
Jonathan
-------------------
LITTLE WORKS STUDIO
http://www.LittleWorksStudio.com
Navigation:
[Reply to this message]
|