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

Inserting a variable in a link
I have this code that I want to insert for my own variable but I have no idea how. This is what I wa

Best way to read this text file.
Hi.I am planning to make a small application in C# to convert the players from Football manager 2010

Printing a webpage
I use this to print the webpage: o

Doubles are giving me problems
Ok so, first of all i made a double = 0.05, but when running the debugger it shows up as 0.04999. I

Using mysql_real_escape_string for displayed content
On my website users can input data into a textarea and it will store it in the mysql database. But,

Object Interfaces
EDIT: Never mind, I just updated to php 5.

Hey all,

I'm currently experimenting with p

How to give the privillege for triggers?
Hi,

How to give the privillage for triggers to particular user?

Please let me

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

Variables and Include
Code: [Select]<?php

$header = $_COOKIE['mss']['header'];
$body = $_COOKIE['mss']['b

Firewall / visited websites logger
Hi. I have a firewall implementation and I want to log all the websites visited on the machine. S

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