CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   General web building (http://www.codingforums.com/forumdisplay.php?f=10)
-   -   html in text boxes (http://www.codingforums.com/showthread.php?t=171)

McP 06-17-2002 06:39 AM

html in text boxes
 
i want to have text boxes with code in them for viewers to copy... i have the text box code but any html i put into them wont show on page or is altered (so the browser dosent read them i guess??)...i tried some different things but still no luck...any help is welcomed....... THANKS

boxer_1 06-17-2002 07:54 AM

Use special characters
 
You'll need to use special characters (ISO Entities) for your angle brackets (<...>).

Let's say your offering code inside of a textarea for your visitors to copy. As opposed to inserting your code like:

<html>
<head>
Etc.....

You need to use &lt; and &gt; to make your brackets. Here's an example:

<html>
<head>
<title>Example</title>
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" alink="ff0000" vlink="#800080">
<form>
<textarea rows="7" name="displayHTML" cols="45" wrap="virtual" style="width:50%">
&lt;html&gt;
</textarea>
</form>
</body>
</html>

Copy/paste/preview the above to see what I mean.

See http://hotwired.lycos.com/webmonkey/...al_characters/ for more special characters.

Sorry for such a brief explaination, reply back here if you need further assistance ;).

Jeewhizz 06-17-2002 02:21 PM

You can do this if you have PHP on your server. Just create a string with the html in it and use the following code

PHP Code:

<?
$string 
"<html><head>....</html>";
echo 
htmlspecialchars($string);
?>


McP 06-17-2002 08:30 PM

&lt; &gt; is just what i needed.........Thank You both for responding
:)


All times are GMT +1. The time now is 07:26 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.