SkyRanger Posted April 8, 2007 Share Posted April 8, 2007 ok, I am having a problem, I can get the files to list but I can't get them to propogate a single drop down. Each one is making there own drop down. This is what I have: <? if ($handle = opendir('lang')) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $filename = $file; ?> <select name="esslang"> <option value=" <? echo ''.strip_ext($filename).''; ?>"><? echo ''.strip_ext($filename).''; ?></option> </select><? } } closedir($handle); } ?> Link to comment https://forums.phpfreaks.com/topic/46171-solved-dropdown-problem/ Share on other sites More sharing options...
SkyRanger Posted April 8, 2007 Author Share Posted April 8, 2007 Anybody have any ideas on how to fix this problem. Tried a number of things but ended up back to where I started. Link to comment https://forums.phpfreaks.com/topic/46171-solved-dropdown-problem/#findComment-224501 Share on other sites More sharing options...
SkyRanger Posted April 8, 2007 Author Share Posted April 8, 2007 Solved the problem myself. Had to redo the whole code: <select name='esslang'> <? //define the path as relative $path = "/yourdir"; //using the opendir function $dir_handle = @opendir($path) or die("Unable to open $path"); //running the while loop while ($file = readdir($dir_handle)) { if($file!="." && $file!="..") echo "<option value=".strip_ext($file).">".strip_ext($file)."</option>"; } //closing the directory closedir($dir_handle); ?> </select> Link to comment https://forums.phpfreaks.com/topic/46171-solved-dropdown-problem/#findComment-224516 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.