Hi all,
I am trying to create a snippet of developing a viewing files in a select/list menu being dynamically created so it displays all files in a certain directory
only problem is that when i do this i get this back for some reason
<br/> contents of the directory:rank<br/> <select name="cnt">
<option value="">Please a file</option><option value=1">1</option><option value="">Please a file</option><option value=1">1</option><option value="">Please a file</option><option value=1">1</option> </select>
now why am i getting 1 for value and name of the value??
can anyone help me out here please,
Here is the code i am using
Thanks,WilliamPHP Code:$dir="rank";
$odir=opendir($dir);//will open the directory
echo "<br/> contents of the directory:".$dir."<br/>";
?>
<select name="cnt">
<?
while($contents=readdir($odir))//read the contents of the directory
{
if($contents="." || $contents="..")
{
echo "<option value=\"\">Choose a file</option>";
echo "<option value=".$contents."\">".$contents."</option>";
}
}?>
</select>
<?
closedir($odir);//closes the directory that is open
What am i doing wrong???








Bookmarks