busystock Posted February 13, 2010 Share Posted February 13, 2010 i have more than 100 drop-downs, say named as 's1,s2...s100', with showing value as 's1_show,s2_show...s100_show'. obviously i want to list all drop-downs via a loop... each drop-down has its own array, named as 's1_array, s2_array...s100_array', with select option as: s1_array=array( array('s1_1','s1_1_shoooooooow','s1_1_coode'), array('s1_2','s1_2_shoooow','s1_2_coooode'), ... array('s1_20','s1_20_shoooow','s1_20_cooode') ) s100_array=array( array('s100_1','s100_1_shooow','s100_1_code'), array('s100_2','s100_2_shoooow','s100_2_cooode'), ... array('s100_12','s100_12_shooooooooooow','s100_12_coooooode') ) how can i show all 100 drop-downs with their select options in the loop(s)? any other approaches? thank you. Link to comment https://forums.phpfreaks.com/topic/191980-lots-of-arrays/ Share on other sites More sharing options...
teamatomic Posted February 13, 2010 Share Posted February 13, 2010 foreach($array as $sub) echo <select name=$sub> { foreach($sub as $key=>$value) { echo <option name=$value>$value</option> } echo </select> } You will need to correct the syntax and may need a bit of tweaking but this is the basics of it. HTH Teamtomic Link to comment https://forums.phpfreaks.com/topic/191980-lots-of-arrays/#findComment-1011899 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.