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

MySQL-PHP Query Results Help
Hello all. I'm hoping to be able to get some help in solving a problem with query/rowcount output. I

How to display objects in a row
I have 7 codes that i want to display in a row one next to another.
The first is {$ads->ad

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

check if value exists
I have googled this for a while and I am getting lots of different results. Is there a standard meth

Quick variable question
hey guys/gals,
im trying to write a php script and it works fine as i have it, but i need to set

File upload issues
Hi Guys,

Can anyone see any issues with this code:
Code: $setImage= 'productimages/' . dat

Limiting checkboxes?
Hi guys,

I have this code: Code: if(isset($_POST['selected'])) {
foreach($_POST['selec

listing help
Hi,

at first, great new design!!! I like it,

i got a problem,

I want to list so

dynamic table with forms
I have a table that is populated with mysql data and in teh first column there is a raido button tha

square instead of number
Hello
I do not know why but this code seems to work fine only in my xampp local insallation but n

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