RE: [PHP] Assigning unique form names...

From: Date: Mon, 08 Apr 2002 17:11:27 +0000
Subject: RE: [PHP] Assigning unique form names...
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-92088@lists.php.net to get a copy of this message
Try <select name="files[]"> The square brackets will allow you to capture selections from multiple lists in an indexed array, $files. Hope that does what you need. -Kevin The square brackets will allow you to capture the variable $file_name -----Original Message----- From: Jas [mailto:jlgerfen@hotmail.com] Sent: Monday, April 08, 2002 10:59 AM To: php-general@lists.php.net Subject: [PHP] Assigning unique form names... 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); ?> Thanks in advance, Jas -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

« previous php.general (#92088) next »