Jump to content


Photo

using a combo box to display dir


  • Please log in to reply
1 reply to this topic

#1 Obadiah

Obadiah
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 17 October 2006 - 10:13 PM

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;
    }
  }
}
?>


#2 Obadiah

Obadiah
  • New Members
  • Pip
  • Newbie
  • 6 posts

Posted 18 October 2006 - 07:18 PM

anyone?!?




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users