Byron Albert <[EMAIL PROTECTED]> wrote:
> I have a few forms that  are used to input html.  We have run into a
> problem of &lt; and &gt;  getting turned into < and > when you hit
> submit, Or if you hit submit more than once. I have attached a sample
> form.  The major problem here is that some times we want &lt; and some
> times we want to input html tags. Has any one else run into this problem
> maybe even found a solution.

when you re-display user input in a textarea (or as the value
attribute of a text input field), you should use the htmlentities()
function. so, from your code:

> <TEXTAREA NAME=test rows=10 cols=50><? echo $test; ?></textarea>

should be:

> <TEXTAREA NAME=test rows=10 cols=50><? echo htmlentities($test); ?></textarea>

(you could also probably use CDATA sections and avoid calling
htmlentities(). i haven't tried it, and am skeptical that the various
browsers all get that right. i've never had a problem using
htmlentities() in this manner.)

jim

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to