php script for mail form - question -

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
Hi I got the following script going;

$sendTo = "";
$subject = "My web site reply";

$headers = "From: " . $_POST["name"];
$headers .= "<" . $_POST["email"] . ">\r\n";
$headers .= "Reply-To: " . $_POST["email"] . "\r\n";
$headers .= "Return-Path: " . $_POST["email"];
$message = $_POST["message"];
mail($sendTo, $subject, $message, $headers);

It's simple and save and I'm not really into php (yet!)...
However I have a question regarding my script.
In the Email body/message I receive after the form is filled in and
I only see the message - obvousily because of this line $message =
$_POST["message"]; -
Now I would like to receive to name and email address in mail
body/message to.
How do I go about to achieve this, I've tried the following...

$message = $_POST["name"];
$message = $_POST["email"];

after I added the above two lines it didn't result in anything.
Anyone wanna fill me in on how I can put this to work.
Thank, appreciate it!

Re: php script for mail form - question -

cartoonsmart wrote:
Quoted text here. Click to load it
In a word 'concatenation', need to look up concatenation of strings

$myvar = 'I am this';
echo $myvar; //displays 'I am this'

$myvar = 'I am this';
$myvar = ' and I am that';
echo $myvar; //now displays only ' and I am that'

$myvar = 'I am this';
$myvar .= ' and I am that';
echo $myvar; //now displays 'I am this and I am that'

Also your code is just a strip down example, right? You are not really  
doing the code exactly like this:

 > $headers = "From: " . $_POST["name"];
 > $headers .= "<" . $_POST["email"] . ">\r\n";

if so, stop and do a little research on security...

Take care,

Site Timeline