Hi again,
Given the info, I can't be too specific, but I would probably use GET parameters - when the directory name is clicked (are you using <select>? Then set a redirection OnChange with JavaScript or something - or use submit button), pass the dir name via URL and based on that, readdir() that dir and display whatever's in there in the way you like.
I chose GET, but depending on what you're trying to do, you may want to take a different approach. Hope this gives you some idea.
Good night...