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] Quote Link to comment 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] Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.