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

Help a newbee save my job !
Hey guys i am dying here i am new to php and would like for someone to help me with this problem

A little help in c#
i am doing a simple paint program using c# i want to draw with the mouse so i wrote the code of the

SAP Logon Failed
I tried to login to SAP through MMC.

When i click start and give password.

it

Thread in PHP
Thread in PHP
Some basic use and basic code for thread in php
This is my question?

Displaying values from a SQL count...
Hi,
Easy enough question i just forget the exact method ..
I have ...

Code: //count win

PHP Tab Control
Hi All,

I would like to have PHP tab control with/without Javascript.

But I want to r

While Problem
i am having a problem with a while statement here is the code
Code: [Select]<?php
sess

problem with array - multilingual page
this is my test page :
Code: <?php
if(isset($_GET['lang'])) {
if($_GET['la

square instead of number
Hello
I do not know why but this code seems to work fine only in my xampp local insallation but n

pls clear my confusion
Hi friends,

Pls solve my query .

what is the exact use of Scope Resolution Operator( i

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