print text without html
Posted: Thu Sep 28, 2006 3:29 pm
I was wondering if it was possible for php to print text from a database without the html being included, yet still using line breaks?
for example, if i stored the following in a database as text:
This is some text.
new line
<a href="index.html">link</a>
and used
to print it, it would appear like so:
This is some text.
new line
link
So is there a way to print it as it was entered, so that somebody posting a comment can't use HTML, but still have the line breaks for each new line?[/url]
for example, if i stored the following in a database as text:
This is some text.
new line
<a href="index.html">link</a>
and used
Code: Select all
echo (nl2br($text));This is some text.
new line
link
So is there a way to print it as it was entered, so that somebody posting a comment can't use HTML, but still have the line breaks for each new line?[/url]