Jump to content

\r\n and SESSIONS


Oziam

Recommended Posts

Hi guys,

I have come across a problem when working with session data, I have been storing data from a textarea in a session, but the problem is when I retrieve the data and display it back in a textarea or to mysql it saves the carriage returns and line breaks as \r\n not converting it to actual line breaks.

 

e.g saving the following from a text area;

 

Line 1

Line 2

Line 3

 

will actually show as: Line 1 \r\nLine 2 \r\nLine3

 

 

How do I get it to show properly as intended?

I have tried str_replace('\r\n', '\n'); with double and single quotes

 

any helpful suggestions would be much appreciated. Thanks..

Link to comment
https://forums.phpfreaks.com/topic/214079-rn-and-sessions/
Share on other sites

Please post your code.  I'll need to see everything related to getting the data from the form and storing it in the session, and everything from where the data is fetched from the session to where it is put into the HTML again.

 

BTW "\n" is a linefeed, '\n' is a backslash followed by the letter n.

Link to comment
https://forums.phpfreaks.com/topic/214079-rn-and-sessions/#findComment-1113983
Share on other sites

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.