Ok I tried a different way to do it and this is the resulting code... I
still need to be able to make some hidden fields so the contents of the item
selected may be passed to another script which will stick the path of the
file into a database table if anyone wants to give me a hand with that part.
Here is what I have and it is working as far as just reading the directory
and putting the contents into a select box...
<?php
// varible to hold path to directory we wish to open
$dir_name = "/path/to/directory/on/server/";
// opening directory
$dir = opendir($dir_name);
// varible to start form
$file_list .= "<p><FORM METHOD=\"post\" ACTION=\"db.php3\">
<SELECT NAME=\"files\">$file_name";
// read the directory and place them into file names for further processing
while ($file_name = readdir($dir)) {
// exclude "." and ".." file names
 if (($file_name != ".") && ($file_name !="..")) {
// variable to place results of directory into select box
 $file_list .= "<OPTION VALUE=\"$file_name\">$file_name</OPTION>";
  }
 }
// closing select and form and adding select button
 $file_list .= "</SELECT><br><br><INPUT TYPE=\"submit\" NAME=\"submit\"
VALUE=\"select\"></FORM></p>";
// close the directory
closedir($dir);
?>
If anyone knows how to do this in a better way please let me know, but this
works and all it needs is some hidden fields (i am assuming here) so that
the item that the user selects from the list can be further processed, like
sticking the file path (not the actual file) into a database table.  (I need
help with that...)  Enj0y!
Jas



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to