Jump to content

Archived

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

Obadiah

using a combo box to display dir

Recommended Posts

what im attempting to do is get php to spill rthe contents of the files in the last folder...right now it will only search the folders preceding the last and when it gets to the last one it opens it but doesent search the files inside....can anyone help me?!?
<?php
$indent = str_repeat("\t", 5);
$dirname = "resids/{$_SESSION['logname']}/{$_POST['xyz']}";
$filename= "*.pdf";
if (!is_dir($dirname))
{
$dirname="{$_POST['xyz']}";
echo $indent . '<option>Invalid directory specified.</option></select><br>';
echo "<select name=\"abc\">";
$dh=opendir($ob) or die("couldn't open directory");
while(!(($filea = readdir($dh)) === false))
{
        echo"<option>$filea</option>";
}
echo "</select>";
}
else
{
  $dh = opendir($dirname) or die("couldn't open directory");
  while(($file = readdir($dh)) !== false)
  {
    if ($file != '.' and $file != '..')
    {
      echo $indent . '<option' . ((isset($_POST['xyz']) && $_POST['xyz'] == $file) ? ' selected="selected"' : '') . '>' . $file . '</option>' . PHP_EOL;
    }
  }
}
?>

Share this post


Link to post
Share on other sites

×

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.