- If you have html source code you would like to display as it is, and not interpreted by the browser, use:
echo $string = htmlentities($sourceCode)
which will take care of everything for you. If you want to display text in a textbox or input of a form, you should ALWAYS use this; otherwise, a "> will fool the browser into thinking the text area has finished.
- Be aware that tabs and indents will still not show, so you can either do this:
$string = str_replace("\n", "<BR>", htmlentities($sourceCode));
$string = str_replace("\t", " ", $string);
or--
echo "<pre>";
echo htmlentities($string);
echo "</pre>";
pre means preserve whitespace formatting...
Sam