line breaks in between fetched file names


Posted on 16th Feb 2014 07:03 pm by admin

Hi,

I have this code:
Code: <?php
if($dir = opendir('files')){
while (($file = readdir($dir) )!== false){
if ($file !='.' && $file !='..'){
echo '<a href="' . $file . '">' . $file . '</a>';"n";

}
}
closedir($dir);
}
?>
but when it outputs the files from the files folder, it lists them one after another with no spaces etc. How can I make it list one file per line?

e.g.
file_1.doc
file_2.png
file_3.exe

Thanks

No comments posted yet

Your Answer:

Login to answer
176 Like 40 Dislike
Previous forums Next forums
Other forums

Unable to customise toolbar in FCK
Guixt issue
Hello all,

We are experiencing the following problem with Guixt:

Some transact

parse error
Parse error: syntax error, unexpected '[', expecting ')' in /Users/admin/Sites/phptest/array.php on

What am I missing here? Help!
Hello all!. I can't seem to get this working right. Well - it renders right, but something is goin

timed header image rotation
I have a joomla site and I was trying to setup a rotating image based on timing NOT just refreshing

mail with attachment problems
Hi. I have the following code:
Code: else if(file_exists("site".$timp.".zip")

Allowing ' and "
Hello everyone,

I am creating a form where users submit information to go into a database. I

webpage with (simple) login & mysql-db
Hi all,

What I was looking for before was a multi-user password manager, web-based! The offer

Running External Scripts
I am very new to PHP and am not even sure what I'm asking is possible. I have just installed mediaW

Login page problems
I developed a website a few months ago and I am now having an issue with logging into it. The place

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash