astupiduser Posted February 8, 2010 Share Posted February 8, 2010 Hi, I have the following issue: I have a form (textarea), where my user writes a text (e-mail). There are of course some newlines in it. I have to save it in a database and then read it and send it as an e-mail (function mail). The problem is, when I do that all the newlines get somehow stripped and my e-mail has only one line and looks ugly. When I read it and put itt back in the textarea, it looks as it should but not when I mail it. Does anybody have a solution? Regards, astupiduser Quote Link to comment Share on other sites More sharing options...
premiso Posted February 8, 2010 Share Posted February 8, 2010 Before you add it to the body of the email call nl2br on the data to convert newline characters to their html equivalent <br /> Quote Link to comment Share on other sites More sharing options...
astupiduser Posted February 13, 2010 Author Share Posted February 13, 2010 Thanks a lot, it works! Quote Link to comment Share on other sites More sharing options...
trq Posted February 13, 2010 Share Posted February 13, 2010 You should actually use the nl2br function on the way out of the database, not the way in. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.