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

File upload issues
Hi Guys,

Can anyone see any issues with this code:
Code: [Select]$setImage= 'productimages

Printer configuration
Hi All,
Suppose one of the user deleted the printer settings unfortunatly ,then what is the pro

Can I call a class inside a function?
I have a class written in another file that handles my image resizing.

Can I do this (php say

preg_match logical error
Code: <?php
$s = file_get_contents("page.html");
preg_match('/<div cla

Linked Keywords
I am trying to get a script that makes my predefined keyword converted to links and / or converted t

PHP and Javascript
Hi Guys,

Im trying to load the contents of an html file into a text area for editing, this is

CURL XML Request [From C to PHP]
Hi,

I need some help converting this into something that will work with PHP.

Code: #

Filtering Tables
Hello Thanks for any help any one can give Im very new to PHP..

I need to pull data for clien

Socket Server
In my following socket server, I am trying to listen to a connection through port 12345 in my web br

search query in mysql in php problem
my search query wont work, i know, that my codes are correct.please help

Code: [Select]&l

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