-2

I have this code on my website:

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

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

Can this be done?

1

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

<xmp>html code</xmp>

Or use PHP's built in htmlentities function:

$hmtlcode='stuff';
echo htmlentities($htmlcode);
0

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.