RE: [PHP] Dynamic Drop-down list

From: Date: Fri, 09 Feb 2001 01:29:28 +0000
Subject: RE: [PHP] Dynamic Drop-down list
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-38865@lists.php.net to get a copy of this message
sorry for the spam, sometime's i'm stupid ;) yes nathan is indeed correct that SELECTED should only be used once in an index, on the item you want to show up first. more clearly, if multiple instances occur, any new instance of SELECTED will supersede any previous instance. DanO -----Original Message----- From: DanO [mailto:dano@informano.net] Sent: Thursday, February 08, 2001 5:25 PM To: php-general@lists.php.net Subject: RE: [PHP] Dynamic Drop-down list wrong. you can put it on any element in the list. cut'n'paste and try for yourself: <form> <select> <option> <option> <option selected>selected </select> </form> DanO -----Original Message----- From: Nathan Cook [mailto:security@pcsedu.com] Sent: Thursday, February 08, 2001 5:10 PM To: php-general@lists.php.net; todd@aristesoftware.com Subject: Re: [PHP] Dynamic Drop-down list 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 > > -- 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

« previous php.general (#38865) next »