Forum Moderators: coopster

Message Too Old, No Replies

How to print code to page in PHP?

Trying to show HTML as text on the page, not as HTML.

         

HughMungus

1:37 am on Apr 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



How do you print text to a page that is HTML but not AS HTML?

e.g., How would I make

<A HREF="widgets.com">Widgets</A>
appear on the page instead of being a link.

HughMungus

2:54 am on Apr 7, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Nevermind. Figured it out. Basically replace < with &lt; and > with &gt;

ironik

5:22 am on Apr 7, 2005 (gmt 0)

10+ Year Member



if you don't want to do it manually use the htmlspecialchars() function to convert it.

Kachii

5:37 am on Apr 7, 2005 (gmt 0)

10+ Year Member



or htmlentities() function

This function is identical to htmlspecialchars() in all ways, except with htmlentities(), all characters which have HTML character entity equivalents are translated into these entities.