Hello! There are textarea on stanitsa used as a notebook where I write all sorts of notes
первая строка вторая строка третья строка after saving it turns out
первая строка\nвторая строка\n\nтретья строка also displayed in the database (field type TEXT).
Here's how to write and extract data:
function change_note () { $note = (string)$this->request['note']; bb_update(Array('note' => DB()->escape($note),)); $this->response['html'] = 'сохраненo'; } <script type="text/javascript"> ajax.change_note = function() { ajax.exec({ action : 'change_note', note : $('#note').val() }); }; ajax.callback.change_note = function(data){ $('#res_note').html(data.html); } </script> <table><tr> <th colspan="2"><h3>NOTE</h3></th> </tr><tr><td> <textarea rows=15 cols=150 id="note" name="note">{NOTE}</textarea> <br><input type="button" value="SAVE" onclick="ajax.change_note();"> <div id="res_note"></div> </td> </tr></table> $template->assign_vars(array("NOTE" => nl2br($note)));
I do not display the saved data in a separate block, but in the same textarea .
It is interesting that after the next save, another one is added to the existing one \
SAVE
первая строка\\nвторая строка\\n\\nтретья строка\nчетвертая
SAVE
первая строка\\\\nвторая строка\\\\n\\\\nтретья строка\\nчетвертая\nпятая
What do you need to do to display the result from the database without \n displayed (as a normal transfer) and why does the extra \ appear after the next saving of the note?