Jump to content

Trouble with textarea for an online editor


dptr1988

Recommended Posts

I made an online text file editor that uses < TEXTAREA>....< /TEXTAREA> tags for the editor. The problem is that if you try to edit a file that contains < /TEXTAREA> the browser will close the textare right there and the rest of the file after is parsed as HTML. Can I disable the < /TEXTAREA> tag without modifying any of the text. Is there another multi-line editory in HTML that i can put any text into?

Thanks
Here is a sample of my editor [a href=\"http://dptr1988.mooo.com/editor_test.php\" target=\"_blank\"]http://dptr1988.mooo.com/editor_test.php[/a] View the source for a better understanding of what I'm wanting. How can I have the < /TEXTAREA> tag in a textarea?
I would suggest you use htmlentities when the data is pulled into the textarea like so:
[code]<textarea ... blah ...><?php echo htmlentities($file_contents); ?></textarea>[/code]
then when you got to save the changes use a function called html_entity_decode

This will undo the changes htmlentities did, like so:
[code]$file_contents = html_entity_decode($_POST['textareaName']);[/code]

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.