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

Help with php code
Hello, can anyone tell me why this php word trap fails to work,
and the trigger words get blow r

help finding hacking loopholes
i was attacked by a redirect php injection

my pc is clean of viruses

so i figure that

Form errors in an array
I'm processing a form and putting the errors in an array. empty($errors) doesn't seem to do the tric

If a record matches an existing record do nothing
So I don't know if I should put this here or in mysql, but what my script is for is for people to ad

Parse String
I need to parse the string below into three variables. How would I do that?

john + 10/20/2008

Deleted Delivery but material wont return
We deleted a delivery but the material its still pending.

We made a reverse goods movemen

SCRIPT ERROR
Here is the CONTACT FORM I made for our website:

<form id="form1" name="

How to show more than 1 users with this code...
Hello,
i have a table that shows users only if I, as Administrator, want to be shown. But its sho

Help with echo()
I'm having some problems with this code:

Code: echo '
<A HREF="jav

Placing and array within an array then sorting it!
I have a page that runs two large mysql queries and saves the results into arrays, in php I then per

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