I’ve read many posts and done tons of searching/testing but just cant seem to figure it out:
I’m trying to create a simple php form for my website.
I’m making the first one simple and just asking for name, email, and comments.
The PHP I’m currently using is
<?php
if(isset($_POST['submit'])) {
$subject = "Contact Form";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$comments_field = $_POST['comments'];
$from = 'From: '.$name_field."
";
$to = "adam@XXXXX.com";
$body = "From: $name_field
E-Mail: $email_field
Comments: $comments_field";
mail($to, $subject, $body, $from);
}
?>
That’s sending me this email (to which I’ve made revisions):
-
Why is the top text “email” and “comments” being indented?
-
How can I add a message below? I’ve tried fooling around with $msg = “yada yada yada”, but I can’t seem to get it.
Thanks in advance!