You are here: Re: select tag « HTML « IT news, forums, messages
Re: select tag

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]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация