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

noob cURL help
I have a pretty basic form that I need to cURL post to a file in my includes folder (includes/login.

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

Random date selection
i want to select random date with time(hour+minutes+sec) where date is specified(10/22/2009) and tim

get multiple rows
Hi I want to get multiple rows from a db

I am using this for the db query
Code: public

how to get different value in second view of webdynpro?
hello guys,

In ABAP webdynpro I am trying to create one application having two views.

EU VAT Package 2010
Does any one know whether SAP will be developing new reporting functionality due the new VAT rules t

Mail Script Problems
I have created a PHP mail script. I am having a problem though. In $body i am trying to put two va

big pagination problem in php
<?php

$connect = mysql_connect("localhost", "root", "")

Something Non-Traditional. Can we solve?
I have an idea for an application here. It's mostly flash, but it couldn't work without a somewhat n

How to set pass login name from htaccess to php
When the user logs into my members page via htaccess, I'd like to retain the username so that I can

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