Hi,
I'vge got piece of code that collects all the files in a certain directory ($path) en puts them in an array. Now I'd like to display only the directories in a selectbox. I've tried this, but something seems to go wrong: in $path there are 3 different directories, but only one (the first one) is being displayed in the selectbox. I've pasted the relevant code below, what am I doing wrong ... ??
Thanks in advance, Michiel
<?php
if (!$dir)
{
$i=0;
$dirs = array();
$handle=opendir("$path");
while ($dir = readdir($handle))
{
$dirs[$i] = $dir;
$i++;
}
closedir($handle);
sort($dirs);
reset($dirs);
if (sizeof($dirs) == 0)
{
echo("Er zijn geen mappen gevonden");
}
else
{
echo("<FORM name=\"setdir\" action=\"admin.php\">\n");
echo("<INPUT type=\"hidden\" name=\"typedpassword\" value=\"$typedpassword\">\n");
echo("<INPUT type=\"hidden\" name=\"typedusername\" value=\"$typedusername\">\n");
echo("<SELECT name=\"dir\">\n");
echo("<OPTION value=\"\">Kies een map</OPTION>\n");
for ($j=0;$j<sizeof($dirs);$j++)
{
if (is_dir($dirs[$j]))
{
echo ("<OPTION value=\"/$dirs[$j]\">$dirs[$j]</OPTION>\n");
}
}
echo("</SELECT>\n");
echo("<INPUT type=\"submit\" value=\"kies map\">\n");
echo("</FORM>\n");
}
}
?>