Hi
So say I have a form that is meant to collect data from users. At the moment, other than stripslashes I am not modifying the content...it simply comes to my inbox.
Now say the user says something like this:
"Hello
My name is Rob
Look at me"
What *I'll* receive in my inbox is
"Hello My name is Rob Look at me".
So my question is this: how would I modify the text so that the new line breaks are somehow preserved in the email message?
Thanks a lot
Rob
[SOLVED]Preserving New Line Breaks in an Email
Moderator: General Moderators
[SOLVED]Preserving New Line Breaks in an Email
Last edited by waboo386 on Thu Jun 24, 2004 3:57 pm, edited 1 time in total.
Yes nl2br() is works well in your problem.
Moreover if you want to convert <br> back to \n this may be helpfull.
And you may find more on the manual.
Moreover if you want to convert <br> back to \n this may be helpfull.
Code: Select all
<?php
function br2nl( $data ) {
return preg_replace( '!<br.*>!iU', "\n", $data );
}
?>