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
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>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.