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

RadioButtonList data selection
view plaincopy to clipboardprint?

Search in the PHP Files
have to search asterisk(*) in the php code of the php files .
In the html page one text box

php + mysql count consecutive data
I have a database of values and I want to work out how to display them if the values match a consecu

Coding Critique
I was hoping someone could take a second and look down my code and see if they see any problems with

grouping within a foreach?
hello all,

I currently have a list of products spit out from my db via a foreach loop. Right

PHP switch function help
Hi, I am trying to create a search function for a directory website. On the search function on html

Upload simple problem
Really confused!! I run once and it worked, but when i tried today...it didn't work

Which par

Need PHP help... have all the elements... just need help putting them together :
Hey Guys,

I was wondering if someone could help me. I am doing a website for a client which

Facebook status update API
Hello,

So, I'm trying to create my first Facebook application with PHP.

Basic ideas fo

insert quotes
Hi,

I have an output like this:
Code: john,18,Cancer
How can I change this to
Code:

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