Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Line Breaks \n Not Working Correctly

Status
Not open for further replies.

hunterjm

Technical User
Mar 24, 2004
3
US
I am in the process of trying to send a confirmation email through PHP from an online form. I have the following code in my page all on one line...

$message = "School Grade completed May 2003: ".$requiredgrade."\nName of School: ".$requiredschool_name."\nT-shirt Size: ".$requiredtshirt_size."\n\n";

The problem comes when I check the email that is sent and I receive the following all on one line...

School Grade completed May 2004: 3rd Grade Name of School: EHS T-shirt Size: Youth Medium 10-12

Sometimes the \n line breaks work fine. Other times they do not. Anyone else ever had this problem? Please help if you have any ideas.

Thanks!

 
Just a shot in the dark, but could it be the email client that is the problem (and not the code)?
 
Or you could try:

\r\n



Skute

"There are 10 types of people in this World, those that understand binary, and those that don't!"
 
Okay. The problem has been solved. From doing some other research, I have found that buzzt was correct. The problem was that Outlook was removing some of the line breaks just for fun. I uncheck the option under Tools > Options > Email Options and all is well now. I have Outlook 2003. I am not sure if this is an issue with previous versions. I have never had a problem until now.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top