Jump to content

help with dynamic drop down list please!!


jp15

Recommended Posts

Over to the experts,

I have spent a while trying to produce customize some code, this is what it does so far.

Displays files from the "uploads" directory in a drop down list.

Uses java script to remove a value from the list.

 

What I would like to be able to do and I need to no if its "doable" is;

 

- make the links to files active (so the file will open when selected, maybe with the aid of a button would be nice)

 

- once a user has removed a value from the list, to remove the file from the "uploads" directory and no just the list.

 

Is this possible, if not, are there other ways to achieve this.

Appreciate your help guys.

 

Code:

 

<?php

$dir = opendir('location');

echo '<select id="mySelect">';

 

while ($read = readdir($dir))

{

 

if ($read!='.' && $read!='..')

{

echo '<option> <a href="files/'.$read.'">'.$read.'</a></option>';

}

 

}

 

echo '</select>';

 

closedir($dir);

?>

<input type="button" onclick="formAction()" value="Delete">

</form>

Link to comment
https://forums.phpfreaks.com/topic/193449-help-with-dynamic-drop-down-list-please/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.