Re: Assigning unique form names...
| From: | Jas | Date: | Mon, 08 Apr 2002 20:03:09 +0000 |
| Subject: | Re: Assigning unique form names... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-92124@lists.php.net to get a copy of this message | ||
Yeah I have tried $file_name but the problem stems from the while
($file_name = readdir($dir) being called after the creation of the form in
$file_list. Is there a way to put the ($file_name = readdir($dir) before
the $file_list function? I have tried to do it a couple of different ways
such as making a new variable $files = ($file_name = readdir($dir)) {
if (($file_name != ".") && ($file_name !="..")) {
$file_list .= "<OPTION VALUE=\"$file_name\"
NAME=\"$file_name\">$file_name</OPTION>";
}
}
but that didn't work, I also tried another thing but so far nothing has
allowed me to create a unique action in the form or a unique name for the
form.
<?php
$dir_name = "/path/to/images/directory/";
$dir = opendir($dir_name);
$file_list .= "<p><FORM METHOD=\"post\" ACTION=\"**I need this to be a
unique file name**\" NAME=\"$file_name\"><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);
?>