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

Adding meta tags under Zend FW
Hello there, recently has come to my hands the FTP of a website which is running under Zend, I would

Time script, set to my time zone?
I am using this line to get the date and time

Code: $time = date(F." ".d.", &q

need help in creating captcha
hi i have a problem creating captcha system. i create some basic script for image displaying but it

question about header() security
is is safe to just use the header() function to redirect someone if they are, say, not logged in? or

storing video files into mysql in php
hi

i have my video files in my folder ,
i have to store the path of the videos into db an

Embed Video Problem
Hey, thanks for looking!

File to be embedded:

Code: <playlist version="1&q

Database 'Validation'
Hi everyone,
I'm trying to validate the password entered by the user with the password in the dat

my login script page is not working on remote computers
hi my login is working on my computer, but when i tried 2 computers from 2 different locations, they

Page not Loading After Test
Hey All

It seemed that an inlcude statement wasn't working for some reason, so I tried a more

limitations on array_unique()
Does any one know what/how imitations are applied to array_unique? I have an issue where no matter h

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