line breaks in between fetched file names


Posted on 16th Feb 2014 07:03 pm by admin

Hi,

I have this code:
Code: <?php
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

176 Like 40 Dislike
Previous php-forum Next php-forum
Other php-forum

Session variable help
I'm having a very troubling issue. Maybe I'm just looking over something but I have looked at the co

matching numbers inside ( )
I know I can match numbers by just [0-9]+, so I thought matching numbers inside ( ) would be somethi

Error Messaging not working
I changed the way my form tells the user of an error. But I can't seem to get it to work properly.

Sharing PHP Sessions Across Domains
I am in the process of writing a script to share a php session across various domains I have.
The

Variable Clash
In the past I've had variables clash. For example:

Code: <?php
$c = 5;
$ca

Help with setcookie()
Merry Xmas to those on this foruum
Older guy here with some experience but not allot so please be

Grabbing Values From an Array for Posting
I have a grid array that I am using with a form that when it hits the currently named test.php it lo

Javascript or not?
How many people prefer javascript/ajax sites? How many prefer the good old fashion straight php sit

fopen() security
As i understood the usage of fopen() for it to function correctly the Dir you write to has to be rw

DirectoryIterator and Hacked Website
Hi Everyone.

My problem:
Some one has been sneaking in to my website hidden Iframes. I've

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