Adding line feed or br in a str

ohsnyder
04:10:12
Running out of hair - please help.

What is the proper syntax to get a line feed in the resulting email that $strMessage is passed to ? I just can not get it to work !


$strMessage = "Content: ".$_POST["txtfname"]." \\n ".$_POST["txtlname"]." \\n ".$_POST["txtDescription"]." ";

The email gets sent fine but everything is all on one line.
smo1234
04-11-2012
It should be \n
not \\n
ohsnyder
04-11-2012
I had already tried your suggestion but just be sure I tried it again but the email sends fine but there are no LFs CRs in it. All the fields print on the same line.

Code is now: $strMessage="Content: ".$_POST["txtfname"]." \n ".$_POST["txtlname"]." \n ".$_POST["txtDescription"]." ";

I have tried "\n"and that throws an error. What really puzzles me is there are no syntax errors but the code does NOT produce the desired results.

i.e Actual Results = John Doe Description

Desired Results:

John
Doe
Description
etc ...
etc ...

Can it be the position of the \n ? I've tried several different placements but keep getting syntax errors.
Can it be forced with 'hidden' fields in the table that contain a <br /> or <p /> ?
smo1234
04-11-2012
If you are sending text based email then \n will work , but if you are sending html emails then you have to use line break tag <br>.

If you are sending any user data then you can use nl2br function to add line breaks for every carriage return and line breaks added by user.
Please Login to post your reply or start a new topic