readdir & option value

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
more or less that is my problem:

i'm making HTML <select><option> statement:

if ($dir = @opendir("/the/directory)) {
    while($file = readdir($dir)) {

echo '<option value="'.$file.'">'.$file;

the number of options depends of number of files in directory.

When user chooses one of this files(he chooses an option) i want to know
what option he choosen.

how can i do this?

Re: readdir & option value

Give the select control a name e.g. <select name="file">. Then the
selected file will be in $_REQUEST['file'] when the form is submitted.

-Sauli Karhu

Piotr Wolski wrote:

Quoted text here. Click to load it

Re: readdir & option value

Sauli Karhu wrote:
Quoted text here. Click to load it
$_POST['file'] exactly

Site Timeline