Forum Moderators: coopster

Message Too Old, No Replies

Enabling user to use HTML in a textarea field

         

galkid

2:49 am on Jan 24, 2007 (gmt 0)

10+ Year Member



We have a form in a php file and want to allow the user to use HTML directly in the textarea to format their input. What would be the code to put in for this feature?

Thanks.

cmarshall

3:12 am on Jan 24, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



They can put in whatever text they want. How you use and filter that text is up to you.

If you want to execute it immediately, then you can avoid even having to go to the server. JavaScript with innerHTML will give you pretty much what you need.

If you want to store it, then just store what they type in. When you output it, it will be interpreted as HTML unless you do htmlspecialchars() or htmlentities() with it first.

unperturbed

1:46 pm on Jan 24, 2007 (gmt 0)

10+ Year Member



galkid, do you mean something like htmlarea?

[edited by: coopster at 2:53 pm (utc) on Jan. 24, 2007]
[edit reason] no urls please [/edit]

coopster

6:02 pm on Jan 24, 2007 (gmt 0)

WebmasterWorld Administrator 10+ Year Member



Sure sounds like it, unperturbed. There is another similar discussion going on right now titled Any one know of a FREE TEXT BOX for PHP [webmasterworld.com] that might be of interest.