Hi,
I have a script that lists the files in a directory, and
create links accordingly but if the files contain spaces then the link
won't come out correctly. I am fairly new to PHP and have no real idea
on how I can get it to make links show as <a href="link"></a> currently
it will put links like <a href=link></a> which is causing the problem.
Below is the script.
[script]
<?
function directory($result) {
$handle=opendir(".");
while ($file = readdir($handle)) {
if ($file == "." || $file == "..") { } else { print "<a
href=$file>$file</a><br />\n"; }
}
closedir($handle);
return $result;
}
?>
[/script]
I did try going else { print "<a href="$file">$file</a><br
/>\n"; } but all I get is PHP errors doing this until the double quote
is removed, any help in this would be great.
Clay