# Adding fields to PHP mailing script?

**URL:** <https://forum.kirupa.com/t/adding-fields-to-php-mailing-script/100124>\
**Category:** Uncategorized\
**Created:** [January 26, 2004, 5:34am UTC](https://forum.kirupa.com/t/adding-fields-to-php-mailing-script/100124 "2004-01-26T05:34:28Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![RageW0lf](https://avatars.discourse-cdn.com/v4/letter/r/e495f1/32.png) [@RageW0lf](https://forum.kirupa.com/u/RageW0lf)\
**Post date:** [January 26, 2004, 5:34am UTC](https://forum.kirupa.com/t/adding-fields-to-php-mailing-script/100124/1 "2004-01-26T05:34:28Z")

</div>

Hi,

I have looked at the PHP mailing tutorial with MX on this site made by Sonocular and it works fine no problems there. However I want to have the user at my site send more stuff to me.

The PHP mail script that I need to alter is as follows:

PHP:--------------------------------------------------------------------------------

\<?php

$sendTo = "tcarling@yahoo.com";  
$subject = “Sent website form”;

$headers = “From: " . $\_POST[“name”];  
$headers .= “\<” . $\_POST[“email”] .”\>  
";  
$headers .= "Reply-To: " . $\_POST[“email”];

$message = $\_POST[“message”];

mail($sendTo, $subject, $message, $headers);  
?\>

* * *

What I am trying to do is add another field say “address” to this and I am not sure how to do it. I have tried doing the following:

PHP:--------------------------------------------------------------------------------

\<?php

$sendTo = "tcarling@yahoo.com";  
$subject = “Sent website form”;

$headers = “From: " . $\_POST[“name”];  
$headers .= “\<” . $\_POST[“email”] .”\>  
";  
$headers .= "Reply-To: " . $\_POST[“email”];

$message = $\_POST[“message”] "  
" $\_POST[“address”]

mail($sendTo, $subject, $message, $headers);  
?\>

* * *

but then it doesn’t work at all. Woohoo!

I have also tried adding anoth $ variable and then adding it to the mail line. Unfortunately this does not have the desired effect either ☹

Can anybody explain how I would add another, or several more fields using this script?

Thx for any help.
