Jump to content

edit forum post issue


EchoFool

Recommended Posts

When editing a forum post on my website i have the problem of seeing all the break links as <br> in the text area.

 

When i post a message i use nl2br() function so the structure remains when they post something but if they wish to edit it they will then see the all <br> in the text box whilst editing...

 

Is there a way to solve this issue so that they will see the structure and not all the <br> in the text box whilst they edit their post? How does phpfreaks do it ?

Link to comment
Share on other sites

You should not use nl2br on data BEFORE it goes into the database. You should enter the data into the database as RAW meaning with the \n characters. Before displaying the data on a page, you would use nl2br and if you are displaying it in a text area, do not use nl2br on it.

 

As it is I would suspect you are entering it into the database after running nl2br on the text, and thus the <br>'s are being entered into the DB instead of the new line characters, which, as you just found out can cause issues. If you are not doing it, then omit the nl2br on text data being put into a textarea.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.