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?
Link to comment
Share on other sites

[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 ** ;)
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.