lxndr Posted July 23, 2010 Share Posted July 23, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/208648-textarea-problems-with-carriage-returns/ Share on other sites More sharing options...
freelance84 Posted July 23, 2010 Share Posted July 23, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/208648-textarea-problems-with-carriage-returns/#findComment-1090037 Share on other sites More sharing options...
lxndr Posted July 23, 2010 Author Share Posted July 23, 2010 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. Quote Link to comment https://forums.phpfreaks.com/topic/208648-textarea-problems-with-carriage-returns/#findComment-1090045 Share on other sites More sharing options...
freelance84 Posted July 23, 2010 Share Posted July 23, 2010 http://www.phpfreaks.com/forums/index.php/topic,305232.0.html Ha, it looks like we both hit a very similar problem at the same time Quote Link to comment https://forums.phpfreaks.com/topic/208648-textarea-problems-with-carriage-returns/#findComment-1090050 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.