PHP Script help....line breaks??

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

scoates

Thread Starter
Joined
Sep 5, 2003
Messages
11
Hi.

I've got a php script I'm using to email form results from a webpage to the client. However, I can't seem to get the line breaks in the output to sit right...they're all over the place!

Here an excerpt of my script:

Code:
$messageproper =

	"This message was sent from:\n" .
	"$http_referrer\n" .
	"COMMENTS:\n\n" .
	$comments .
        "NAME:\n\n" .
        $name .
        "ADDRESS:\n\n" .
        $street .
        "APT:\n\n" .
        $aptorsuite .
        "CITY:\n\n" .
        $city .
        "PHONE:\n\n" .
        $phone .
	"\n\n---------------------- END ----------------------------\n" ;
Unfortunaltely, the results appear like this in the out put (email):

This message was sent from:
http://www.websiteurl.com/general/contest.html
COMMENTS:

NAME:

George McFlyADDRESS:

166 Main StreetAPT:

1225CITY:

TorontoPHONE:

416-777-7777

---------------------- END ----------------------------

Why arent the line braking correctly? Isn't "\n" supposed to do that? Why are the first few lines and the last line breaking alright. The problem seems to start at the "Name" result.
 
Joined
Oct 9, 2001
Messages
27,087
Rockn, he's not using VB :)

it's doing exactly what you told it to do, but you need to put a \n after you interpolate a variable.

ie.
You have this....
PHP:
"COMMENTS:\n\n" .
$comments .
"NAME:\n\n" .
It should be more like:
PHP:
"COMMENTS:\n\n" .
$comments .
"\n\n" . 
"NAME:\n\n" .
Notice the extra \n\n between $comments and "NAME:" :)

--HTH
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 807,865 other people just like you!

Latest posts

Members online

Top