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