line breaks in between fetched file names


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

Hi,

I have this code:
Code: <?php
Did you know?Explore Trending and Topic pages for more stories like this.
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

Save username into DB
OkaY so I got my blog to actually save the posts and whatever, all I need now is for it to keep the

Sending UDP Raw socket
I truly need help on this. I am trying to write a test program that simulate a network environment

unexpected T_STRING
error log "[Sat Jan 09 18:27:58 2010] [error] [client 127.0.0.1] PHP Parse error: syntax error

Basic Forum Tutorial
Hi, I'm new to PHP. I want to build a basic forum for my site using PHP and MySQL. I've searched t

Ajax Issues - Update Panel / Timer. Intellisense doesn't know about them
Type 'System.Web.UI.ScriptManager' does not have a public property named 'UpdatePanel'. That is wha

PHP & MS Access - Line Break
Hey Guys!

I'm pulling records from an MS Access database and listing them using PHP and I'm r

Need help with a mail notify function
I was tasked with setting up a site that's been prewritten. The site is basically a form that captur

how to use two buttons with php
hi i have one form. there are three fields which are to be filled by the user. and then there are tw

Really need helps regarding Pagination with Sort
I need someone helps regarding pagination problem...i actually want to make my page limited to let s

Show specific day of the week
I have been racking my brain trying to get this function to work properly and it is doing so for eve

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