Re: Conditional default value of drop-down list

From: Date: Wed, 23 Apr 2003 17:56:28 +0000
Subject: Re: Conditional default value of drop-down list
References: 1  Groups: php.db 
Request: Send a blank email to php-db+get-27310@lists.php.net to get a copy of this message
see below Jason End wrote: > How could I make the default value of the list be > conditional on the categories id? So if the variable > categories id is "3", $listdefault[3]="selected"; echo "<select count=\"1\" name=\"categories\">\n"; // walk through list of categories somehow, // in this case, an array called $catlist for ($i=1; $i<=count($catlist);$i++) { echo " <option value=\"$i\" $listdefault[$i]>$catlist[$i]</option>\n"; } echo "</select>\n"; > the initial value shown in that > drop down menu will be the description of the category > with id 3. > Does this make sense? > > thanks, > > J > > __________________________________________________ > Do you Yahoo!? > Yahoo! Tax Center - File online, calculators, forms, and more > http://tax.yahoo.com

« previous php.db (#27310) next »