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

How to grab certain words ??
I am working with this API

Returns JSON.
curl http://letsbetrends.com/api/current_trends

paginate search result
Hi, I have a paginations script to display data from my database but i would like to paginate someon

Table trouble
i have been reading the forum for a few weeks and decided to join. i like the format and the advice

Expandable Post Code
Hi,

Hope you can help. Which currently I haven't upgraded to connect to a mysql server, so i

PHP form authentication
Hi guys,

what am trying to achieve is this: Whenever a user tries to login to my website, an

First root of a number
Hi,

I can't find any function in php to give me the first root of a number.
Is there any

quotes changing
hi all

in my content

opening quotes " changes to “

close qu

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

Show message after entering data
Hello Colleagues

I would like to display messages after entering the data example: "
dat

SAP Treasury - Commodities
We are running SAP ECC 6.0 with Treasury Activated.
EA-FIN is also activated (SFW5).

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