I am trying to create a dynamic dropdown select menu from a directory containing other directories and files. This is to select a certain page from the list so I can edit it. I only want the files in the menu. Here's what I have so far but it doesn't populate the dropdown.
<?php
$folder = 'tplesystm';
echo "<form name=\"subscribe\" action=\"submit.php\" method=\"post\">\n";
echo "<select name=\"folder\">\n";
echo "Enter day : <input type=\"text\" name=\"day\">\n";
echo "<input type=\"submit\" name=\"submit\" value=\"Subscribe\">\n";
echo "</form>\n";
if ($dh = opendir($folder)) {
while (false !== ($file = readdir($dh))) {
if (is_dir($file) && $file != '..' && $file != '.') {
echo "<option value=\"$file\">$file</option>\n";
}
}
closedir($dh);
}
echo "</select>\n";
?>