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