View Full Version : Rich Text Editor Line Break Difficulties

10-29-2008, 02:24 AM
1) Script Title: Rich Text Editor (for textareas)

2) Script URL (on DD): http://www.dynamicdrive.com/dynamicindex16/richtexteditor

3) Describe problem: I am using the Rich Text Editor that was created in the article linked to above. I have it set up where it submits the data entered into the text box to a specified database, which works fine. I am able to call the information from the database and place the text that was previously submitted back into the text box, if the page is refreshed. However, my problem is this: if any line breaks are submitted to the database, once they are re-displayed in the text box, the entire text box disappears. Getting rid of line breaks in the database allows the text to display properly in the text box, but keeping line breaks in the database entry will make the text box not appear. Line breaks are replaced with <br> tags when writing text in the text editor, but that is not the problem. The problem is that, when an HTML code is added, there is a line break after the HTML tag and this line break obviously does not have a <br> to replace it. So, any line break in the entry will not appear correctly in the text box when the submitted text is displayed in the rich text editor. Can anyone help me with this? If you need more information, I will happily provide it for you.

11-01-2008, 07:51 PM
Hm, I'm surprised that no one else has ever had this problem. Is more explanation needed so that my question can be understood? Because I can explain it more, if needed.

04-09-2009, 01:03 AM

$text = str_replace(array("\n", "\r"), array('\n', '\r'), $strthatcomesfromdb);

before the writeRichText function