redarrow Posted September 9, 2006 Share Posted September 9, 2006 i need to get the select statement to show all the directorys in the select output please help cheers.know if i put the echo $info within the loop then i get 6 sets of selects so i am trying to output one select with all dir how?[code]<?php$dirpath = "files/"; $dlist = opendir($dirpath); while ($read = readdir($dlist)) {$info="<select name='dir'><option value='$read'>$read</option></select>";}closedir($dlist); echo $info;?>[/code] Link to comment https://forums.phpfreaks.com/topic/20211-solvedselect-dir-problam-cheers/ Share on other sites More sharing options...
.josh Posted September 9, 2006 Share Posted September 9, 2006 [code]<?php$dirpath = "files/"; $dlist = opendir($dirpath); $info = "<select name='dir'>";while ($read = readdir($dlist)) {$info.="<option value='$read'>$read</option>";}closedir($dlist); $info.="</select>";echo $info;?>[/code] Link to comment https://forums.phpfreaks.com/topic/20211-solvedselect-dir-problam-cheers/#findComment-88888 Share on other sites More sharing options...
redarrow Posted September 9, 2006 Author Share Posted September 9, 2006 so what was it then the way i set the select up then can you exsplain what was wrong cheers m8.the code is only for me to understand as a test code to see how it works as meny ask the same question so i was intrested to get it going thank you for the ansaw m8.ok i get it if you take the <select name=' '> out of the while loop then it only sees it as one select statement but if within the while loop then loops all.solved cheers. Link to comment https://forums.phpfreaks.com/topic/20211-solvedselect-dir-problam-cheers/#findComment-88889 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.