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

Preg_match with an array
is there an away to use preg_match with an array?

i want to check a string with an array to s

Socket programming
Hello all,

I have a PHP socket script. GPS trackers connect to this socket. IMEI verification

script and html conflict in trying to create a header.
I have an error is occurring because of an html webpage with a "php require" at the top of

Need help making a script that moves data into acrhive table
Hi,

I'm kinda new to php/mysql

And i wrote a simple script to store sales lead for a b

Logic question
im wondering what's the best method to do the above list:

it is for alliance @ MMORPG game

Help with Contact Form
I have this Form on an html page and the associated code on page.php (below).
I keep getting the

Retrieving innerHTML with cURL?
Hey all (sorry I know I'm a leecher, but I soon won't be. This is my first PHP project, but not my l

ctype() validation - allowing illegal characters
Hello,
I use ctype() to filter and validate a user form. However, I am trying to allow certain c

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

Creating a function
Basically i wanna put all this code in a seperate file

Code: <?php

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