01-15-2008, 04:58 PM
|
#4 (permalink)
|
|
The Frequenter
Join Date: Apr 2005
Location: South UK
Posts: 483
Thanks: 51
|
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.
|
|
|