ATbousiasse
New Member
I have a file structure on my server that looks something like this:
My question is relatively complicated: how do I populate \[code\]<select>\[/code\] html tags progressively from the contents of the sub-files of a server.For example, below I have 3 \[code\]<select>\[/code\] tags that mirror the file structure shown above. When the first select is changed, the jQuery should use AJAX and PHP find that directory on the server, and list all sub-files into the second \[code\]<select>\[/code\]. When the second one is clicked, all the sub-files of that folder should be listed, and so on. Eventually I want to have 5 \[code\]<select>\[/code\] tags.
I think this is best accomplished using jQuery, which detects a change in a select:\[code\]$("select").change(function() { var selected = $(this).children("option:selected").text();});\[/code\]sends that variable to AJAX, which asks a PHP file to return an array of the sub-files of that folder, and fill the next select with the data from that array. Where I am not so confident is the PHP.What I have tried: looked at TreeView systems - not suitable. Tried to modify TreeView systems to work with selects - fruitless! Maybe someone can try and modify the one I've linked?Thanks in advance, any help will be, as always, much appreciated!