01-15-2008, 06:11 PM
|
#8 (permalink)
|
|
Moderateur
Join Date: Apr 2007
Posts: 1,393
Thanks: 5
|
How about :
PHP Code:
foreach(glob('../categories/*', GLOB_ONLYDIR) as $dir)
{
$dir = basename($dir);
echo '<option value="', $dir, '">', $dir, '</option>';
}
We use GLOB_ONLYDIR as in Wildhoney's example to grab the paths to directories within ../categories, then grab only the directory name (using basename()), before outputting the option HTML element.
Aside: Note the use of commas to separate expressions for the echo statement, rather than concatenating to a string.
|
|
|
|