Jump to content

[ resolved ]My read text file script cant recognize line breaks from a .txt file


ztealmax

Recommended Posts

[code]<?PHP require_once("theme.php");?>
<?php
// set file to read
$file = $_GET['text'];
// open file
$fh = fopen($file, 'r') /*or die('Could not open file!')*/;
// read file contents
$data = fread($fh, filesize($file)) /*or die('Could not read file!')*/;
// close file
fclose($fh);
// print file contents


?>
<DIV class="smallblacktext">
<? echo $data;?></DIV>[/code]

My read text file script cant recognize line breaks from a .txt file


for example of text file:

[code]
This is my computer and it rocks....
This is my keyboard and it rocks too..
[/code]

in my code it comes up like this:
[code]This is my computer and it rocks....This is my keyboard and it rocks too..[/code]

Does anyone know how to sort it out?
[quote author=devnerds link=topic=118444.msg484010#msg484010 date=1166012327]
[code]<DIV class="smallblacktext"><pre>
<? echo $data;?></DIV></pre>[/code]

That should do it.
[/quote]

thanx worked great ;)
however i didnt see
[code]<pre></pre>[/code] saw it first when i comented you ;)

Thanx :D

** Noticed you saw that it wasnt showing up too ** ;)

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.