How to write from file to HTML

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Sorcerer
Forum Newbie
Posts: 2
Joined: Tue Aug 31, 2004 5:30 am
Contact:

How to write from file to HTML

Post by Sorcerer »

Hi everybody!!!!

I have a problem and hope you could help me out....
I'm new to PHP, but need to use it for one function....
This function should recive a filename and the open the
file( which is located on server side) and write it line by
line in to a cell of a HTML table.... I've been trying to do this
and I was told it is easy to do... but didn't manage.... :(
Can anyone help me PLEASE!!! Or give me a link to some
tutorial that would explain how to make this things??
Any help appreciated!!
McGruff
DevNet Master
Posts: 2893
Joined: Thu Jan 30, 2003 8:26 pm
Location: Glasgow, Scotland

Post by McGruff »

See manual: [php_man]include[/php_man]
Last edited by McGruff on Mon Aug 08, 2005 1:31 am, edited 1 time in total.
User avatar
ol4pr0
Forum Regular
Posts: 926
Joined: Thu Jan 08, 2004 11:22 am
Location: ecuador

Post by ol4pr0 »

Or if u mean a text file.. *.txt that is.

Code: Select all

$file = "youre_text_file.txt";
		$fh = fopen($file,'r') or die ("couldnt open file to read");
		$file_size =filesize($file);
		$fcontent = fread($fh,$file_size);
		fclose ($fh);
		echo '<pre>';
		echo $fcontent;
		echo '</pre>';
timvw
DevNet Master
Posts: 4897
Joined: Mon Jan 19, 2004 11:11 pm
Location: Leuven, Belgium

Post by timvw »

in that case [php_man]readfile[/php_man] is even less lines ;)
Sorcerer
Forum Newbie
Posts: 2
Joined: Tue Aug 31, 2004 5:30 am
Contact:

Post by Sorcerer »

Thanks a lot :D
U made me happy :D
Post Reply