I can't make a newline or carriage return

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
HUWUWA
Forum Commoner
Posts: 35
Joined: Sat Aug 17, 2002 7:24 pm
Location: Long Island, NY

I can't make a newline or carriage return

Post by HUWUWA »

Hi guys, I'm getting data from a form and mailing it to myself but I can't make a newline/carriage return :(

Here is what I do:
$strMailMessage="From: " . $strName . "\n\r" . "Email: " . $strEmail;

It comes out all on one line.

It should look like this:
From: Joe Blow
Email: joe@php.net

What am I doing wrong ? Thanks.
User avatar
llimllib
Moderator
Posts: 466
Joined: Mon Jul 01, 2002 2:19 pm
Location: Baltimore, MD

Post by llimllib »

well, first off, the line terminator for emails is \r\n (CRLF), not \n\r.

As for why it's not printing a line in between, are you viewing it in a web browser? if so, \r\n's don't make a difference, <br>'s do. do View->Source and see if there's a line in between them.
HUWUWA
Forum Commoner
Posts: 35
Joined: Sat Aug 17, 2002 7:24 pm
Location: Long Island, NY

Post by HUWUWA »

Oops :oops:

Hi, yeah, I was checking it on my browser. I'll try it the way you said now.

I'm still kinda a newbie.

Thanks.
User avatar
llimllib
Moderator
Posts: 466
Joined: Mon Jul 01, 2002 2:19 pm
Location: Baltimore, MD

Post by llimllib »

don't be ashamed, you've gotta make the little stupid mistakes before you can make the really stupid mistakes.
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

llimllib wrote:don't be ashamed, you've gotta make the little stupid mistakes before you can make the really stupid mistakes.
I agree to that llimllib...
User avatar
gotDNS
Forum Contributor
Posts: 217
Joined: Tue May 07, 2002 5:53 pm
Location: West Chester, PA

Post by gotDNS »

don't be ashamed, you've gotta make the little stupid mistakes before you can make the really stupid mistakes.
lol...good way to put it...and it's true...not smart/stupid enough at first :P
Post Reply