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

No comments posted yet

Your Answer:

Login to answer
176 Like 40 Dislike
Previous forums Next forums
Other forums

Linux socket programming
Where can I find a good introduction to socket programming?

Loops and Classes
I am making a template system and everything seems to be going well up until I have to loop in a var

path to include folder
Hi everyone,

When I'm testing locally, I have to add the name of the site folder as part of t

How to replace search button with link?
hi to everbody.
i have a search submit form and button like this :

<form id="f

urldecode question
How would I format this line of code properly?

<?php echo urldecode($_GET['Title']); ?

Blocking video streaming
Hello everyone,

I post a message here because i didn't find any solution yet.
I just finis

temporary objects
Until now i thought every temporary object in C++ is created as constant. I'm wondering why my compi

Array question
Does anyone know how to create a program that takes the $ amount for 8 different departments and gi

random generation
hi

i need help with generating this

numbers from 1-12

i want to generate in ran

Get ID from Database when Posting with a HTML Form
I have a form I am submitting to a MySql database. Each product has an ID # attached to it that auto

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