<? $items["One"]=1; $items["Two"]=2; $items["Three"]=3; $items["Four"]=4; $items["Five"]=5;
outPutFormDropDown($items,"my_list","4"); function outPutFormDropDown($items,$field_name,$selected=""){ if(!is_array($items)) return; ?> <select size="1" name="<?=$field_name?>"> <? foreach($items as $name=>$value){ ?> <option value="<?=$value?>"<?if ($selected==$value) echo " selected";?>><?=$name?></option> <? } ?> </select> <? } ?> > -----Original Message----- > From: Chakravarthy Cuddapah [mailto:[EMAIL PROTECTED] > Sent: 21 December 2003 12:47 > To: [EMAIL PROTECTED] > Subject: [PHP] List values > > Can anyone pls tell me how to dynamically list values in a > ListMenu. The values do not come from any database. They are > stored in php variables. Sample code will be highly appreciated. > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php