Forum Moderators: coopster

Message Too Old, No Replies

Ugly email posting

Posted email format untidy

         

audaddy

6:49 am on Feb 22, 2007 (gmt 0)

10+ Year Member



Hey there all.

Totally new to the forum and VERY much a junior with php.

I have writen a simple script to extract the values from a form and post them to email, and all is working well, accept that the email format is quite ugly.

The script is as follows:

<?php //send email script


$message .= "Salutation:".$_POST['salutation']."/n";
$message .= "First Name:".$_POST['first_name']."/n";
$message .= "Last Name:".$_POST['last_name']."/n/n";
$message .= "Address:".$_POST['no_and_street']."/n";
$message .= "Address:".$_POST['suburb']."/n";
$message .= "Address:".$_POST['post_code']."/n/n";
$message .= "Home Phone:".$_POST['home_phone']."/n";
$message .= "Work Phone:".$_POST['work_phone']."/n";
$message .= "Mobile:".$_POST['mobile']."/n/n";
$message .= "Email:".$_POST['email']."/n/n";
$message .= "Description:".$_POST['description']."/n";


mail( "dave@mydomain.com", "Contact Form Information",
$message, "From: mydomain.com" );
header( "Location: thankyou.php" );

?>

And the email that I recieve, with all fields filled in:

Salutation:Mr/nFirst Name:David/nLast Name:Van Oeveren/n/nAddress:345/nAddress:Anywhere/nAddress:55555/n/nHome Phone:54116559/nWork Phone:52654465/nMobile:0425875142/n/nEmail:myemail@mydomain.com/n/nDescription:This is what the form posts to email./n

I thought the "/n" would display the next lines contents on a new line in the email, and not just display the /n in the email as it has done.

Some help would be appreciated, thanks.

[edited by: dreamcatcher at 9:10 am (utc) on Feb. 22, 2007]
[edit reason] Removed domain info. [/edit]

omoutop

6:52 am on Feb 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



welcome to webmasterworld

try using \r\n for line breaks

audaddy

8:47 pm on Feb 22, 2007 (gmt 0)

10+ Year Member



The same thing happened, accept now the email contains /r as well.

Salutation:Mr/r/nFirst Name:david/r/nLast Name:van /r/n/r/nAddress:3 daidng/r/nAddress:enalgedg/r/nAddress:345/r/n/r/nHome Phone:3654656/r/nWork Phone:365654646/r/nMobile:3134564/r/n/r/nEmail:hsdaljg@lkahjgt/r/n/r/nDescription:not sure if this is working yet, but we will see./r/n

Not sure what is going on.

GoldFish

9:12 pm on Feb 22, 2007 (gmt 0)

10+ Year Member



Audaddy,

You're using forward slashes where you should be using backslashes.