Jump to content

Recommended Posts

Insert the code into the DB without trying to change line breaks.

 

When you subsequently retrieve it from the DB, and want to display it, use the nl2br() function

 

when i insert the data to the db without changing line breaks the db is populated with a <br>

 

when retreiving, the <br> stays and doesnt perform a line break, when using the nl2br() function

 

@mr shawn

i never get those chars to replace in the first place

@ricmetal

 

that method would only work after you had use htmlspecialchars() function. It is just to replace the special chars back to tags.

 

but after htmlspecialchars, the special chars are changed to tags...and the tags aren't rendered. i dont know why.

 

please help

 

okay, i got it.

it works fine with using nl2br after using the htmlspecialchars.

 

ps. i failed to see that i was fetching some data to insert to the db from innerHtml, so the br tag was appearing in the db on those data fields.

 

okay, i got it.

it works fine with using nl2br after using the htmlspecialchars.

 

ps. i failed to see that i was fetching some data to insert to the db from innerHtml, so the br tag was appearing in the db on those data fields.

 

 

becuase < is changed to < so you will see the tags

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.