I was trying to populate my dropdown menu with file names from a directory, I have searched for articles here at SO regarding this inquiry I found several answers and tried them but none of them seems to work which I find weird because they were chosen as answers and some of them have High votes take this article for example this is one of the reference that I have tried but it seems like it does not work for me
Here is my code based on the reference link that I Have provided
<select name="templ" class="form-control input-sm">
<?php
foreach(glob(dirname(__FILE__) . '/els-content/*') as $filename){
$filename = basename($filename);
echo "<option value='" . $filename . "'>".$filename. </option>";
}
?>
</select>
this does not return any values at all. What could be the problem ?