Jump to content

How can I store information in the database and keep end of line characters?


DeX

Recommended Posts

I have a text area where text is entered on a webpage, it's submitted into the database, then displayed on the next page. When it's displayed, it is pulled from the database and it's just one long string, all the returns (enter) used to separate lines are ignored.

\n characters don't actually mean anything in displayed content (they only format the 'view source' of your page in the browser.)

 

Use nl2br when you output content on the page to add HTML <br> tags to each \n character.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.