|
Posted by Gordon Burditt on 02/04/06 01:35
>I have following code for putting contenst of a file into a web page:
><?php
> $filename = "../msd/news.txt";
> $handle = fopen ($filename, "r");
> $content = fread ($handle, filesize($filename));
> fclose($handle);
> echo ($content);
>?>
>But in file news.txt I have formating that is not showing, but
>interpreting.
If you output the content of a file in the middle of a bunch
of HTML, it will be interpreted as HTML.
>For example, in that file there is:
><a href="link.php">link</a>
>End result is hyperlink.
>
>Can you tell me what I did wrong?
I suggest something like:
echo (htmlentities($content));
Although I don't think that will deal with newlines being interpreted
as going to a new line, vs. HTML ignoring line breaks.
Gordon L. Burditt
Navigation:
[Reply to this message]
|