# Multiple folders and file

**URL:** <https://forum.kirupa.com/t/multiple-folders-and-file/284837>\
**Category:** Uncategorized\
**Created:** [March 24, 2009, 8:54am UTC](https://forum.kirupa.com/t/multiple-folders-and-file/284837 "2009-03-24T08:54:58Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![irkevin](https://avatars.discourse-cdn.com/v4/letter/i/67e7ee/32.png) [@irkevin](https://forum.kirupa.com/u/irkevin)\
**Post date:** [March 24, 2009, 8:54am UTC](https://forum.kirupa.com/t/multiple-folders-and-file/284837/1 "2009-03-24T08:54:58Z")

</div>

here it goes… i have folder A … in folder A, there are some folders… and in those folders, there are some files…

I have a code that list all folders in folder A and output them in a dropdown… Now what i need, is choose a folder in the dropdown and output the files in another dropdown… Is that possible?

I’ve been able to list the folders in folder A, but i have no clue what code to use to check what folder have been selected and output the corresponding files…

here is the code i have

```php
<?php

/*#######################################################
*                                                        
* THIS BLOCK OF CODE IS TO FETCH THE FIRST FOLDERS                                            
* AND OUTPUT THEM IN OUR DROP DOWN MENU        
*
********************************************************* /

  $path = "./manga/";

  if ($dir_handle = @opendir($path)) 
  {
        
        while (($file = readdir($dir_handle)) !== false) 
        {
            
           if ($file != '.' && $file != '..')
            {   
              $output .= '<option value="'.$path.$file.'" name="'.$file.'">'.$file.'</option>';
            }
           
        }
        
        closedir($dir_handle);
    }
      else
    {
        echo "Unable to open $path";
    }
    
?>
<select id='choose' name='choose' onchange='selectManga()'>
<option>Choose a manga</option>
<?php echo $output;?>
</select>

```

Help me plz
