Jump to content

[SOLVED] Dropdown problem


SkyRanger

Recommended Posts

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

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>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.