Re: Dynamic Drop-down list
| From: | Nathan Cook | Date: | Fri, 09 Feb 2001 01:10:13 +0000 |
| Subject: | Re: Dynamic Drop-down list | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-38859@lists.php.net to get a copy of this message | ||
Moreover, you can put SELECTED only on the item you want to show up first.
.:: Nathan Cook [ ncook@pcsedu.com ] ::.
Systems & Network Administrator :: Programmer
[ phone - 208.343.3110 ][ pager - 208.387.9983 ]
----- Original Message -----
From: "DanO" <dano@informano.net>
To: <php-general@lists.php.net>
Sent: Thursday, February 08, 2001 6:05 PM
Subject: RE: [PHP] Dynamic Drop-down list
>
> the 'SELECTED' attribute will select an item in a dropdown list.
>
> by default, with no SELECTED attribute, the first item will be shown and
> selected.
>
> make sense?
>
> DanO
>
>
> -----Original Message-----
> From: Todd Cary [mailto:todd@aristesoftware.com]
> Sent: Thursday, February 08, 2001 5:00 PM
> To: php-general@lists.php.net
> Subject: [PHP] Dynamic Drop-down list
>
>
> I create a Drop-down from a DB table. All works as expected *except*
> the default item (the one showing to the surfer) is the last in the
> list. Is there a way I can have the first item show?
>
> Todd
>
> /* Make a drop-down */
> function make_dropdown($ddName, $itemList, $first) {
> if (count($itemList)) {
> echo("<SELECT NAME=" . $ddName . ">");
> if ($first) {
> echo('<OPTION VALUE="**" SELECTED>' . $first);
> };
> while (list ($key, $val) = each ($itemList)) {
> echo('<OPTION VALUE="' . $key . '" SELECTED>' .
> $val);
> };
> echo("</SELECT>");
> };
> };
>
>
>
> --
> Todd Cary
> Ariste Software
> todd@aristesoftware.com
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net
>
>