Please help: I need new lines in a php contact form
Posted: Sun Jul 19, 2009 10:24 am
Hi-
Here's my problem: The contact form is working, but when it sends an email all of the text runs together. How do you put new lines in between the name, email, phone, and message? I have spent hours trying to figure this out. I confess I have no PHP background, just learning as I go. Thanks for any help.
Here's my problem: The contact form is working, but when it sends an email all of the text runs together. How do you put new lines in between the name, email, phone, and message? I have spent hours trying to figure this out. I confess I have no PHP background, just learning as I go. Thanks for any help.
Code: Select all
<?php
session_start();
if( $_SESSION['6_letters_code'] == $_POST['6_letters_code'] && !empty($_SESSION['6_letters_code'] ) ) {
$to = "myemail@domain.com";
$email_subject = "Website Inquiry";
$name = $_POST["name"];
$phone = $_POST["phone"];
$email = $_POST["email"];
$usermessage = $_POST["usermessage"];
$email_body = " You have received a new message from: " . $name .
" Here is the message: " . $usermessage .
" Here is the phone: " . $phone .
" Here is the email: " . $email;
mail($to, $email_subject, $email_body);
echo 'You entered the correct code. Your message was successfully emailed.';
} else {
echo "Sorry, you have provided an invalid security code. Please <a href='contact_form_with_captcha.html'>CLICK HERE</a> to try again.";
}
?>