|
Posted by Sandman on 11/04/66 11:27
In article <rInVe.14457$ct5.12705@fed1read04>,
"Mike Brashars" <mike@apayrollservice.com> wrote:
> Hi all,
>
> I have been searching for a week and am unable to find and example to
> "Populate picklist from directory and return file name".
>
> I have a php script that reads a log file and plots a graph. Right now, the
> log name is hard coded. The logs are archived each day in the form of say
> ddmmyy.log and I would like to put a drop down list in the script that would
> allow my script to run off the "log" picked or default to the current "hard
> coded" name.
>
> I thought this would be a really common thing but I guess not.
>
> I would be open to a javascript or asp script as long as I could "feed"
>
> the file name to my php script.
>
> Can anyone point me to a script like this??
>
> Thanks a million!
<?
# Directory
$dir = "/path/to/a/dir/";
print "<select name='file'>";
while (false !== ($file = readdir($dir))){
if (in_array($file, array(".", ".."))) continue;
print "<option value='$file'>$file</option>";
}
print "</select>";
?>
--
Sandman[.net]
Navigation:
[Reply to this message]
|