Simon336697
asked on
Populating a select box with files from a folder with certain criteria
Hi guys hope u are well.
Guys id like to create a select box that is populated by:
1) Polling a folder for files that have:
2) backup*.php as the criteria
3) On selection of the file in the select box, to go to that page
Any help greatly appreciated.
Guys id like to create a select box that is populated by:
1) Polling a folder for files that have:
2) backup*.php as the criteria
3) On selection of the file in the select box, to go to that page
Any help greatly appreciated.
ASKER
Hi Hielo, mate thank you.
I tried this with the following code in the code snippet, but getting an error:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in C:\wamp\www\dropdowndbpilo t\paginati on\lab\scr ipts\backu p\backup_m ain_page.p hp on line 156
The lines 155 and lines 156 in my code are:
$files = glob( "$_SERVER['DOCUMENT_ROOT'] /$folderPa th/backup* .php" );
if( count($files) ){
I tried this with the following code in the code snippet, but getting an error:
Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE,
The lines 155 and lines 156 in my code are:
$files = glob( "$_SERVER['DOCUMENT_ROOT']
if( count($files) ){
<?php
//assuming the files are at http://www.yoursite.com/somefolder/*
$folderPath ="/dropdowndbpilot/pagination/lab/scripts/backup";
$files = glob( "$_SERVER['DOCUMENT_ROOT']/$folderPath/backup*.php" );
if( count($files) ){
echo "<select onchange='location.href=this.value;'>";
foreach ($files as $filename) {
echo "<option value='$folderPath/$filename'>$filename</option>";
}
echo "</select>";
}
?>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hielo THAT WORKS GREAT MATE.
As usual.....you are just the best mate.
Thanks Hielo :>)
As usual.....you are just the best mate.
Thanks Hielo :>)
you are welcome
Open in new window