On Wednesday 10 April 2002 03:20, Jas wrote: > Here is what I need some information about, the script below opens a > directory on the server, reads the files and places them into select > boxes > within a form, now I have this echoed multiple times on the page like > so...<? echo "$file_list"; ?> Now I have tried to assign a form name > based > on the $file_name varibable but because the $file_name variable is > created > after the form has been created I cannot assign a unique form name each > time > I call <? echo "$file_list"; ?>. If someone could point out another way > to > do this or point out a good function for this I would greatly appreciate > it. > <?php > $dir_name = "/path/to/images/directory/"; > $dir = opendir($dir_name); > $file_list .= "<p><FORM METHOD=\"post\" ACTION=\"index_done.php3\"> > <SELECT NAME=\"files\">"; > while ($file_name = readdir($dir)) { > if (($file_name != ".") && ($file_name !="..")) { > $file_list .= "<OPTION VALUE=\"$file_name\" > NAME=\"$file_name\">$file_name</OPTION>"; > } > } > $file_list .= "</SELECT><br><br><INPUT TYPE=\"submit\" NAME=\"submit\" > VALUE=\"select\"></FORM></p>"; > closedir($dir); > ?>
Will this do? <?php $dir_name = "/path/to/images/directory/"; $dir = opendir($dir_name); $file_list .= "<SELECT NAME=\"files\">"; while ($file_name = readdir($dir)) { if (($file_name != ".") && ($file_name !="..")) { $file_list .= "<OPTION VALUE=\"$file_name\" NAME=\"$file_name\">$file_name</OPTION>"; } } $file_list .= "</SELECT><br><br><INPUT TYPE=\"submit\" NAME=\"submit\" VALUE=\"select\"></FORM></p>"; closedir($dir); $new_file_list .= $file_list . "<p><FORM METHOD=\"post\" ACTION=\"$file_name.php3\"> ?> -- Jason Wong -> Gremlins Associates -> www.gremlins.com.hk Open Source Software Systems Integrators * Web Design & Hosting * Internet & Intranet Applications Development * /* Too much of everything is just enough. -- Bob Wier */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php