2

In a CodeIgniter app, I've a textarea for content entry. I'd like to retain new lines but I'm having the issue that when the data is saved, an extra new line is added with each new line, which then displays in the textarea next time I edit.

How can I get rid of this extra new line, preferably before the data is saved?

mysql_real_escape_string shows the data as follows:

this is the first line\r\n\nthis is the second line\r\n\nthis is the third line

Which displays in the textarea like so:

this is the first line

this is the second line

this is the third line

I just want this:

this is the first line
this is the second line
this is the third line
Your Common Sense
  • 156,878
  • 40
  • 214
  • 345
pingu
  • 614
  • 1
  • 10
  • 23

1 Answers1

0

This is a known bug in the Reactor version of CI 2.0 This was driving me nuts all week. I'm not sure if there has been an official patch yet, but you can find a workaround here:

http://codeigniter.com/forums/viewthread/180078/

More info:

https://bitbucket.org/ellislab/codeigniter/issue/332/newlines-in-textareas-are-duplicated

Wesley Murch
  • 101,186
  • 37
  • 194
  • 228
  • Thanks for this - it's good to know I wasn't just going nuts. I managed to resolve in the end by stripping tags from all of my inputs, but will keep an eye on those links! – pingu Mar 23 '11 at 01:38