View Single Post
Old 01-15-2008, 04:58 PM   #4 (permalink)
Alan @ CIT
Member of the Month
The Frequenter
Member of the Month Top Contributor 
 
Alan @ CIT's Avatar
 
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
Alan @ CIT is on a distinguished road
Default

I'd suggest using the is_dir() function in your while() loop.

Eg:

PHP Code:
<?php 
if ($handle opendir('../categories/')) { 
    
/* loop through directory. */ 
    
while (false !== ($dir readdir($handle))) {
        if (
is_dir($dir))
        {
            echo 
'<option value='.$dir.'>'.$dir.'</option>'
        }
    } 
    
closedir($handle); 

?>
In theory, this should skip anything that isn't a directory.

Note: '.' and '..' are considered directories so you might want to strip them as well

Alan.
Send a message via MSN to Alan @ CIT
Alan @ CIT is offline  
Reply With Quote
The Following User Says Thank You to Alan @ CIT For This Useful Post:
buildakicker (01-15-2008)