jdavis Posted November 19, 2007 Share Posted November 19, 2007 Hello, I am developing a PHP/MySQL project and as part of my initial setup and configuration scripts, the users can select a skin for the application, and a variable value ($skin) is updated to set the current skin, this works ok on it's own, but currently the user must manually type the skin name in a free-text box. Ideally this needs to be a drop-down option box, and I would like this to be populated by listing the sub-folders within the '/skins' folder, so that it's always up to date. The folder structure looks like this: /skins /skins/skin1 /skins/skin2 /skins/skin3 How can I use PHP to generate a list of the current sub-directories in 'skins' and populate the drop-down list? thanks, Jonathan Link to comment https://forums.phpfreaks.com/topic/77924-folder-list-drop-down/ Share on other sites More sharing options...
trq Posted November 19, 2007 Share Posted November 19, 2007 <?php $skins = scandir('/skins'); foreach ($skins as $skin) { if (is_dir('/skins/' . $skin)) { echo $skin . "<br />"; } } ?> Link to comment https://forums.phpfreaks.com/topic/77924-folder-list-drop-down/#findComment-394408 Share on other sites More sharing options...
jdavis Posted November 19, 2007 Author Share Posted November 19, 2007 That looks perfect! Thanks! Link to comment https://forums.phpfreaks.com/topic/77924-folder-list-drop-down/#findComment-394458 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.