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

Operating System
How in PHP or other language can I detect Operating system, ie Windows XP Home, Windows 7 Ultimate,

Echoing ASCII code
I have a php page that splits a string into chars and then echoes the ASCII code for each char. I'm

Mouseover to edit (Ajax)
hi friends, can anyone help with the code behind to get this application working, please in VB (new

FFmpeg Images 2 Video conversion problem ??
I got folder full of images , number of images = 600 , I want to make a video which plays one image

Access website from only 1 computer...?
One of my customers wants his website to only be accessed by people in which they bought the website

help with php
It's not displaying or pulling anything out of the database.


Code: <html><

Greek characters in php
Hi,

I'm making a script and I m using for first time greek characters.
I started to write

Using two $_POST Function / Switch () statements, second does not work.
Hi all. I’m new to php and am having a problem getting $_POST Function / switch () to work. I

How could I do this?
Ive got a simple lottery game, and am using an sql database to keep track of the numbers bought. But

registration form
first time posting. did some searches but didnt find exactly what i am looking for. dont flame cause

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