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

UDP Multicast question
Hey,

Im not really in the know when it comes to network related programming and activitie

that old Malformed Headers problem again!!!!! HELP!!!!!!
I've read the http://www.phpfreaks.com/forums/index.php/topic,37442.0.html

I don't think my c

form variables from database help.
Hi all,

I would like to have a form that gives you options based on the results of an mysql q

Better Method of a Member Cloud
I assume most people know how tag clouds work, where the tags most used are bigger and the least use

Simple Question
I know this is a simple question, that if I knew what it was technically called i could probably loo

problem with query error
First Thanks to those who helped me on my previous posts, and the following code i'm using is not mi

PHP form help required
Hi all! Apologies in advance for having to message the forum for help. I know you must get a lot of

MySQL query problem
When I try to run the following piece of code, I get this error:
QuoteWarning: mysql_query(): sup

if else problem, help please
i have this script that i made only i try to also put in a if else for for some reason the script is

Sessions work for me and not others?
I'm having a bit of bad luck with sessions. In the past they have worked fine for me, but this time

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