title: directory selectbox and then subdirectory selectbox or selectbox with directory and subdirectory in one
body: <p>I got the following code:</p>
  
  <pre><code>    &lt;div style="border:1px solid #CCCCCC; background-color:#F0F0F0; font-family:verdana; font-size:12px; padding:5px;"&gt;
      &lt;?php
      $dir = '../klanten';
      // List of file names to exclude from output
      // NOTE: This is case-sensitive
      $exclude = array('klant_aanmaken.php','klanten_overzicht.php','klant_verwijderen.php','domein_aanmaken.php','domeinen_overzicht.php','domein_verwijderen.php','overzicht.php','documenten_toevoegen.php', 'dlf');
      // Check to see if $dir is a valid directory
      if (is_dir($dir)) {
        $contents = scandir($dir);
        echo '&lt;strong&gt;Selecteer klant: &lt;/strong&gt;&lt;div class="styled-select"&gt;&lt;select id="mydropbox"&gt;';
        foreach($contents as $file) {
          // This will exclude all filenames contained within the $exclude array
          // as well as hidden files that begin with '.'
          if (!in_array($file, $exclude) &amp;&amp; substr($file, 0, 1) != '.') {
    echo '&lt;option&gt;'. $file .'&lt;/option&gt;';
          }
        }
        echo '&lt;/select&gt;&lt;/div&gt;';
      }
      else {
        echo "The directory &lt;strong&gt;". $dir ."&lt;/strong&gt; doesn't exist.";
      }
      ?&gt;
  </code></pre>
  
  <p>And this shows all directories fine. Only i need now another selectbox that shows the directories that are inside the selected directory from above.</p>
  
  <p>Or is there a way to make this selectbox show the subdirectories as well.</p>
  
  <p>I have tried copying this script and change this:</p>
  
  <pre><code>           $dir = '../klanten'./.$file;
  </code></pre>
  
  <p>and</p>
  
  <pre><code>           $dir = '../klanten/'.$file;
  </code></pre>
  
  <p>but both are not working. Thanks in advance for any help.</p>