php on a form needs help please...

Hi all I’m new to php and I just get this thing to work. It’s just a simple form and it sends me a email but it doesn’t send the comments section. The html and php code are below. Any help would be greatly appreciated.


php code:


[php][/php]

Comments <?php $fname = $_POST['fname']; $lname = $_POST['lname']; $email = $_POST['email']; $comments = $_POST['comments']; $newsletter = $_POST['newsletter']; //Sending Email to form owner $header = "From: $email\n" . "Reply-To: $email\n"; $subject = "Submission From My Form"; $email_to = "[email protected]"; $message = "name: $fname . $lname\n" . "email: $email\n"; mail($email_to, $subject ,$message ,$header ) ; ?>

[php][/php]


HTML code:


First Name:
Last Name:
Emai:l
Comments:
Check box if you would like our newsletter
reset
Submit
 

you have assigned the post to a variable called $comments, however, that’s all you have done with it.
I suggest you add it to the $message variable for it to be included.

[php]$message = "name: " . $fname . ’ ’ . $lname . "\n
email: " . $email . "\n
comments: " . $comments . “\n”;[/php]

And by the way, you might want to make the $comments a bit safer and cleaner before sending/storing by using the functions available. (or write your own).

Hope that helps,
Red :wink:

Sponsor our Newsletter | Privacy Policy | Terms of Service