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

php slowing my site?
Hi all,

I think that one of the reasons that my site doesn't work fast is that the code is ve

array_count_values question?
ok i'm trying to create a top ten list from a database of listed favorite movies.

the followi

image upload, resize THEN submit form
Ok so I have a form that requires the user to upload an image, and then do something with that image

Advice on how to delete a mysql row using my form
Hi,

I am very new to php and am struggling to work out how to delete a portfolio item (a row

How to clone an SAP ECC using bacup tape on z/os?
We want to clone our production to a different SID using backup tape.

php email checker
I am having alot of trouble finding info on how to do these email things. I need to do the following

Frustrated php Newbie
First off, I am pretty much a PHP nub. I can read and understand the language (most of the time) so

This must be easy , pulling the last record of the day, every day, from a txt
I have a txt file logging weather data every minutes (so 1 record per minute). I want to extract the

$variable $variables type question
I need to be able to designate an array element dynamically, so I thought to use a variable variable

Production Order Enterprise Service to Manufacturing Exctn Sys (MES) ???
Hello Experts,

In our current landscape SAP ECC 5.0 is integrated to MES system via PI 7.

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