Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.