Hi guys, i was wondering if anyone could help me out here.
I'm trying to display an alphabet. to do this i am using this code
for ($i=65; $i<=90; $i++){
echo '<a href="test.php?f='.chr($i).'">'.chr($i).'</a>';
}
This works as it should. Displays the alphbet each with a link. What I would like to do is when I click on say A it shows the list of files and a link to each file beginning eith the letter A in the directory. So far I have this:
function displaylist(){
$dir = "poems/";
$mydir = opendir($dir);
foreach (glob('poems/A*') as $file) {
$file = substr($file, 6);
echo "<br/><a href=\"test.php?f=".$dir."/".$file."\">";
echo $file."</a>";
}
closedir($mydir);
}
This works but I'm having trouble getting them to work together. I was wondering if anyone could shed some light on this or perhaps show me a better way to go about this. Any help no matter how small is appreciated!!