I have this code on my website:

<textarea name="code" cols="20" rows="5">
echo "Your IP is: ". $_SERVER["REMOTE_ADDR"]; 

I want it so that it shows the code as text, not run it.

Can this be done?


You can either wrap your code in <xmp> tags:

<xmp>html code</xmp>

Or use PHP's built in htmlentities function:

echo htmlentities($htmlcode);

You could remove the <?php starting and ?> ending tag

Not the answer you're looking for? Browse other questions tagged or ask your own question.