Here is a basic format for the select statement. All you have to do is take
the names of all the files and put them into an array, such as $filename[].
Then you place the file name between the option element using a for loop or
something similar. You will have to place a unique value that identifies
which file has been selected by using the "value" attribute of the <option>
element (which can be the same value as the array values if you want it to
be). When you press the submit button, you will have a variable called
$file_name (which was created from the "name" attribute of the <select>
element) and it will have the value of whatever option was selected from the
form. Then you can do whatever you want with the value found in $file_name.
Sorry, I'm too lazy to write the code tonight, but you have a basic
framework for what you need. Remember, the below is just pseudo-code, so
make sure you see that it cooperates with PHP by printing it out correctly,
adding the correct sets of quotes, etc. Then use a loop of some kind to list
the option data as you see fit.

If you have an array which has this:

$filename[0] = "filename1.php";
$filename[1] = "filename2.php";
$filename[2] = "filename3.php";

<select name="file_name">
    <option value="$filename[0]">$filename[0]</option>
    <option value="$filename[1]">$filename[1]</option>
    <option value="$filename[2]">$filename[2]</option>
</select>

So if the user picks option #2, he chose $filename[1], whose value is
filename2.php. After the user hits the submit button then $file_name equals
"filename2.php" and you can use that information however you need it. Hope
that didn't confuse you. If you need further help, please let me know. Good
luck...

- Nilaab




> -----Original Message-----
> From: Stephen [mailto:[EMAIL PROTECTED]]
> Sent: Monday, December 02, 2002 3:04 PM
> To: PHP List
> Subject: [PHP] Show Folder Contents in Form
>
>
> Hello,
>
> Is it possible, and if so how, to get the filenames and last edited
> time/date, then display them in a select field in a form for a user to
> select? I'd need to show them in order of most recently edited to last
> edited. How can this be done if it can?
>
> Thanks,
> Stephen Craton
> http://www.melchior.us
>
> "Life is a gift from God. Wasting it is like destroying a gift
> you got from
> the person you love most." -- http://www.melchior.us
>
>


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

Reply via email to