I have to fill out a specific selection of a JSN Uniform form with the files of a directory, the problem is that clicking on the fill button just reads me a file:
How can I read and load all the files in my folder in that select ("45")?
Code:
echo '<input type="button" value="Llenar Select" onclick="ShowSelected()">';
$directorio = "D:\letritastv\imagenes";
$sizekb = 0.0 ;
$sizemb = 0.0 ;
$dir=opendir($directorio);
while ($file = readdir($dir))
{
if ($file != "." && $file != "..")
{
$variable_php=$file;
echo '<script type="text/javascript">';
echo 'function ShowSelected(){';
echo 'var mivar = " '.$variable_php.' "; ';
echo 'variable = new Option(mivar);';
echo 'var x = document.getElementById("45");';
echo 'x.options[1]=variable;';
echo '}';
echo '</script>';
}
}