ok, i'll try to help, but first use "while (false !== ($file = readdir($dir))". ;) why do you need hidden fields on that page? to determine which file the user has selected? hmmm...ok, let's see: The user sees your form, selects the desired file and submits the form. Now the page processing the request will know which one was selected. in your case $files will contain the value of the selected option field within the select-box files. So why do you need additional input fields for that? Please explain a bit more detailed what exactly is your problem.
"Jas" <[EMAIL PROTECTED]> schrieb im Newsbeitrag [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... > 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