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
Link to comment
Share on other sites

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?
Link to comment
Share on other sites

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]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.