0

This is the situation: i have 4 folders, and inside each a bunch of files.

I am working on files operations in Php. I would like, to create a dynamic form where, once is selected the folder, to fill up another dropdown list with the list of the files that are inside that folder.

This is the first part of the form, where the user can choose a folder:

<select name="origin">
    <option value="folder">Folder</option>
    <option value="folder2">Folder2</option>
    <option value="folder3">Folder3</option>
    <option value="folder4">Folder4</option>
</select>

How can i create the other dropdown list?

Thank you very much!

4

3 に答える 3

0

jQuery (または必要に応じて通常の JavaScript) を使用すると、関数をドロップダウンの変更イベントにバインドできます。次に、AJAX を使用してサーバー上のファイルを呼び出し、すべてのファイルを含む JSON 形式の文字列を返し、そこからドロップダウンを作成します。すべてのファイルを取得するには、PHP 関数scandirを使用できます。

于 2013-06-19T19:12:24.360 に答える