473,395 Members | 2,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Drop-Down Directory...Subdirectory..Files

I have a directory structure that is constantly being updated.

Config (Root)
--City (Sub-Dir)
----Address (Sub-Dir)
------File

I'm trying to create a script that will:

1. Scan a directory (will be a root dir) and place the directory names in a drop down box.

2. Choose option (dir) and a 2nd box will appear with subdirectores

3. Once you select an option, a 3rd will be presented

4. This directory will have 1 file that needs to be downloaded

Expand|Select|Wrap|Line Numbers
  1.  
  2. <?php
  3.  
  4. $dir = "D9034-Configs";
  5. if (isset($_GET['Site'])) { $Site = $_GET['Site']; } else { $Site = $_POST['Site']; }
  6. if (isset($_GET['IP_Address'])) { $IP_Address = $_GET['IP_Address']; } else { $IP_Address = $_POST['IP_Address']; }
  7.  
  8. if (!(isset($Site)))
  9. {
  10. ?>
  11. <form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
  12.   <select name="Site" id="Site">
  13. <?php
  14.   $output = shell_exec('ls ./'.$dir.'/');
  15.   $dirs = explode("\n", $output);
  16.   foreach ($dirs as $key => $value)
  17.   {
  18. ?>    <option value="<?php echo $value?>"><?php echo $value?></option><?php
  19.   }
  20. ?>
  21.   </select>
  22. </form>
  23. <?php
  24. }
  25.  
  26. if (isset($Site))
  27. {
  28. ?>
  29. <form id="form1" name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']?>">
  30.   <select name="Site" id="Site">
  31. <?php
  32.   $output = shell_exec('ls ./'.$dir.'/');
  33.   $dirs = explode("\n", $output);
  34.   foreach ($dirs as $key => $value)
  35.   {
  36.     if ($value == $Site)
  37.     {
  38. ?>    <option value="<?php echo $value?>" SELECTED><?php echo $value?></option><?php
  39.     }
  40.     else
  41.     {
  42. ?>    <option value="<?php echo $value?>"><?php echo $value?></option><?php
  43.     }
  44.   }
  45. ?>
  46.   </select>
  47.   <select name="IP_Address" id="IP_Address">
  48. <?php
  49.   $output = shell_exec('ls ./'.$dir.'/'.$Site.'/');
  50.   $dirs = explode("\n", $output);
  51.   foreach ($dirs as $key => $value)
  52.   {
  53. ?>    <option value="<?php echo $value?>"><?php echo $value?></option><?php
  54.   }
  55. ?>
  56.   </select>
  57. </form>
  58. <?php
  59. }
  60.  
  61. ?>
Apr 29 '10 #1
0 1231

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: riehe | last post by:
Dear all I want to drop a node from a nodegroup. Can someone confirm if its enough to redistribute a node group with a partition map which doesn't include the node to be dropped? I can't see...
1
by: Ian Dobson | last post by:
Hi, I need to drop a schema from a database but it has 400 tables in it. Is there an easy way to do it other than drop table schema1.table1 drop table schema1.table2 etc.. to 400 and then drop...
10
by: BuddhaBuddy | last post by:
Platform is DB2/NT 7.2.9 The table was created like this: CREATE TABLE MYTEST ( MYTESTOID bigint not null primary key, FK_OTHEROID bigint not null references other, FK_ANOTHEROID bigint not...
8
by: WindAndWaves | last post by:
Hi everyone, Has anyone got any experience with drop and drag in Access? I would like to make a calendar style form where my users can drop and drag appointments.... I am using Access 2003...
1
by: Torre Quinn | last post by:
Does anyone have any good sites or resources dealing with adding drag and drop functionality to a set of controls on a form? I'd like to try to get several examples of varied applications of drag...
6
by: jojobar | last post by:
Hello, I look at the asp.net 2.0 web parts tutorial on the asp.net web site. I tried to run it under firefox browser but it did not run. If I want to use this feature in a commercial product...
3
by: VB Programmer | last post by:
In VB.NET 2005 (winform) any sample code to drag & drop items between 2 listboxes? Thanks!
1
by: Darren | last post by:
I'm trying to create a file using drag and drop. I want to be able to select a listview item drag it to the shell and create a file. Each icon in the listview represents a blob in a database. When...
15
by: uwcssa | last post by:
I try to drop a table as: I got: During SQL processing it returned: SQL0478N The object type "TABLE" cannot be dropped because there is an object "sch.SQL070515104729271", of type "FUNCTION",...
5
by: Romulo NF | last post by:
Greetings, I´m back here to show the new version of the drag & drop table columns (original script ). I´ve found some issues with the old script, specially when trying to use 2 tables with...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.