rhyspaterson Posted May 28, 2007 Share Posted May 28, 2007 Hey lads just looking for a bit of help with this dynamic select list menu i'm building. $array can have any number of variables. i would like to list whatever is in it in a select menu. <?php $i = 0; echo "<select name=\"select\">\n"; while ($i <= $array){ ?><option value=""><?php echo $array[i];?></option> <?php $i = $i + 1; } ?> </select> At the moment it doesn't work obviously, haha. Any pointers? Link to comment https://forums.phpfreaks.com/topic/53242-solved-dynamic-while-loop/ Share on other sites More sharing options...
eZe616 Posted May 28, 2007 Share Posted May 28, 2007 try <?php for($i=0;$i < count($array); $i++) { echo "<option value=\"".$i."\">".$array[$i]."</option"; } put that beetween the <select></select> tags Link to comment https://forums.phpfreaks.com/topic/53242-solved-dynamic-while-loop/#findComment-263106 Share on other sites More sharing options...
rhyspaterson Posted May 28, 2007 Author Share Posted May 28, 2007 Ah perfect. Thanks! I love phpfreaks, haha. Donating tonight Link to comment https://forums.phpfreaks.com/topic/53242-solved-dynamic-while-loop/#findComment-263107 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.