Forum Moderators: coopster
i have made a form in php code, but i do not know alot about php just the basics, the problem i have is that when i fill in the form and send it the message i get via email has no brakes in it so its all one long sentance with no spaces to devide from the seprate areas of my form, here is the code,
<?php
} else {
error_reporting(0);
$recipient = 'my@example.com';
$from = stripslashes($_POST['Customer_FirstName']);
$msg = "Message from: $from\n\n".stripslashes($_POST['textarea'])
.stripslashes($_POST['Customer_Home_Telephone'])
.stripslashes($_POST['Customer_Email']);
if (mail($recipient, $from, $msg))
echo nl2br("<b>Your Finance Application has been Sent:</b>
To: $recipient
$msg");
else
echo "Message failed to send";
}
?>
now the ode that displays this:
$msg = "Message from: $from\n\n".stripslashes($_POST['textarea'])
.stripslashes($_POST['Customer_Home_Telephone'])
.stripslashes($_POST['Customer_Email']);
is were my error is and i need to add a line brake in between the .stripslashes so that i dont get one long sentance of all infomation together in one word.
anyone help?
thanks,
Xlilo
[edited by: dreamcatcher at 2:50 pm (utc) on Oct. 7, 2007]
[edit reason] Use example.com, thanks. [/edit]
Add this at the top :
$headers = "From: u@example.com\r\n";
//specify MIME version 1.0
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
n then while sending the mail, send the header too :
if (mail($recipient, $from, $msg, $headers)) {
wteva code
}
n then u can also change this to :
$msg = "Message from: $from <br>".stripslashes($_POST['textarea'])
. "<br>" . stripslashes($_POST['Customer_Home_Telephone'])
. "<br>" . stripslashes($_POST['Customer_Email']);
[edited by: ayushchd at 3:01 pm (utc) on Oct. 7, 2007]
[edited by: dreamcatcher at 5:51 pm (utc) on Oct. 7, 2007]
[edit reason] Use example.com, thanks. [/edit]
<?php
} else {
error_reporting(0);
$headers = "From: u@example.com\r\n";
//specify MIME version 1.0
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$recipient = 'info@example.com';
$from = stripslashes($_POST['Customer_FirstName']);
$msg = "Message from: $from\n\n".stripslashes($_POST['textarea'])
.stripslashes($_POST['Customer_Home_Telephone'])
.stripslashes($_POST['Customer_Email']);
if (mail($recipient, $from, $msg, $headers))
echo nl2br("<b>Your Finance Application has been Sent:</b>
To: $recipient
$msg");
else
echo "Message failed to send";
}
?>
[edited by: dreamcatcher at 5:51 pm (utc) on Oct. 7, 2007]
[edit reason] Use example.com, thanks. [/edit]
$msg = "Message from: $from <br>".stripslashes($_POST['textarea'])
. "<br>" . stripslashes($_POST['Customer_Home_Telephone'])
. "<br>" . stripslashes($_POST['Customer_Email']);
Note : Since you are now sending headers, u can edit your message juss like editing HTML. You can use tables n all those stuffs..if u've noticed, i have used <br> which is an HTML tag
Also you can change $msg :
$msg = "Message from: $from <br>".stripslashes($_POST['textarea'])
. "<br>" . stripslashes($_POST['Customer_Home_Telephone'])
. "<br>" . stripslashes($_POST['Customer_Email']);
Note : Since you are now sending headers, u can edit your message juss like editing HTML. You can use tables n all those stuffs..if u've noticed, i have used <br> which is an HTML tag
example,
email for send this :
customer number<br>customer name<br> etc etc
idealy would like :
customer number
customer name
etc etc
maybe its outlook but like i said, im not to botherd as you have manged to get my form working properly and you answerd my questions with perfection.
Thanks Again,
Xlilo