Stretchwickster
Programmer
Hi there,
I'm hitting a wall of blanks with this after much experimentation and googling!
I have a page which allows "comments" to be entered via an html textarea. If the user has included a carriage return in the text they have typed this is stored in the MySQL field as "\r\n". I should point out that the form is built and rendered using HTML_QuickForm. When I come to view a frozen (i.e. read-only) version of the form, the stored "comments" field looks like this: "First line of text\r\nSecond line of text".
In the textarea.php file (i.e. the HTML_QuickForm file which controls the rendering of a textarea), the getFrozenHtml function is called and attempts to use the nl2br function to convert all the newlines to <br /> tags, as shown in the line below.
However, after using this function the "\r\n" remains in the string. I've done a var_dump before and after the nl2br call and $value contains exactly the same string throughout.
Does anyone know how to solve this one?
Your advice would be much appreciated.
Clive
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096
I'm hitting a wall of blanks with this after much experimentation and googling!
I have a page which allows "comments" to be entered via an html textarea. If the user has included a carriage return in the text they have typed this is stored in the MySQL field as "\r\n". I should point out that the form is built and rendered using HTML_QuickForm. When I come to view a frozen (i.e. read-only) version of the form, the stored "comments" field looks like this: "First line of text\r\nSecond line of text".
In the textarea.php file (i.e. the HTML_QuickForm file which controls the rendering of a textarea), the getFrozenHtml function is called and attempts to use the nl2br function to convert all the newlines to <br /> tags, as shown in the line below.
Code:
$html = nl2br($value)."\n";
Does anyone know how to solve this one?
Your advice would be much appreciated.
Clive

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"To err is human, but to really foul things up you need a computer." (Paul Ehrlich)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To get the best answers from this forum see: faq102-5096