Jump to content

Recommended Posts

I have an html form which features a textarea.  The textarea is originally populated by allowing the user to click on a link which executes the following javascript:

 

document.getElementById('styled').innerHTML='$storyline';

 

where styled is the id of the textarea and $storyline the php variable containing the text as retrieved from a MySQL database table.

 

The user can then make changes to the text within the textarea and then click Update to have it written back to the database and so forth.

 

It all works fine until they use a carriage return within the textaraa.  I can't convert to <br /> as the innerHTML won't work then.  Is there a way round this?

 

Thanks in advance for any help.

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/208648-textarea-problems-with-carriage-returns/
Share on other sites

If the user hits enter in the text area are you saying this carriage return is not being stored in the mysql table? What format is the table in? Mine works ok in MyISAM

 

I've found that when the user hits enter in the text area, this return is saved in the mysql table. When i ask for the text back into the text area from the mysql table, the carriages returns are still there.

If the user hits enter in the text area are you saying this carriage return is not being stored in the mysql table? What format is the table in? Mine works ok in MyISAM

 

I've found that when the user hits enter in the text area, this return is saved in the mysql table. When i ask for the text back into the text area from the mysql table, the carriages returns are still there.

 

No, they are being stored but I can't then retrieve them and assign them by setting innerHTML.  Perhaps there's no way round it and I'll have to find another way of doing it.

 

 

 

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.