Jump to content

using a combo box to display dir


Obadiah

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;
    }
  }
}
?>
Link to comment
https://forums.phpfreaks.com/topic/24270-using-a-combo-box-to-display-dir/
Share on other sites

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.