Re: How do I keep the selected showing...

From: Date: Sat, 03 Mar 2001 07:58:03 +0000
Subject: Re: How do I keep the selected showing...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-42429@lists.php.net to get a copy of this message
hi dave, i usually do this from entries in a database but it should also work this way with an array // first make an array holding all the cities $myTowns = array("London","New York","HongKong","Johannesburg"); $ArrayElements = 4; this is now creating the dropdown-box: <select name="town"> <? for ($i=0;$i<$ArrayElements;$i++) { $selma=""; $tacco = $myTowns[$i]; if ($tacco == $town) { $selma = "selected";} $item="<option value=\"$tacco\" ".$selma.">".$tacco."</option>"; echo $item; } ?> </select> greetinx andre viva technologies ----- Original Message ----- From: "Dave Carrera" <dave@davecarrera.com> To: <php-db@lists.php.net> Sent: Saturday, March 03, 2001 8:29 AM Subject: [PHP-DB] How do I keep the selected showing... > Hi All > I have a fully functional db site which uses 2 sqls and 1 page to give our > visitors info they need. > > That works fine, but some users have remarked that it would be nice that the > selected item from our drop down list stays shown when the page gives the > info instead of going back to the top of the list. > > http://www.angelettes.co.uk/dates/index.php3 is the url in > action and > choosing different towns will show you what I mean. > > Its not the end of the world, as our visitors have said, but would be nice. > > Any help is full appreciated. > > Dave C > > > -- > PHP Database Mailing List (http://www.php.net/) > To unsubscribe, e-mail: php-db-unsubscribe@lists.php.net > For additional commands, e-mail: php-db-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.general (#42429) next »