# PHP mail form - modification

**URL:** <https://forum.kirupa.com/t/php-mail-form-modification/219254>\
**Category:** Uncategorized\
**Created:** [March 15, 2007, 3:43am UTC](https://forum.kirupa.com/t/php-mail-form-modification/219254 "2007-03-15T03:43:08Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nitelava](https://avatars.discourse-cdn.com/v4/letter/n/b9e5f3/32.png) [@nitelava](https://forum.kirupa.com/u/nitelava)\
**Post date:** [March 15, 2007, 3:43am UTC](https://forum.kirupa.com/t/php-mail-form-modification/219254/1 "2007-03-15T03:43:08Z")

</div>

Love the form tutorial – Thanx!

Q: how can i send a confirmation email with a generic text + form output to the user who is sending the form? Here is the code:

\<?php  
if(isset($\_POST[‘submit’])) {

```
$to = "msn@msn.com"; 
$subject = "Subject!";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
    $phone_field = $_POST['phone'];
$dropdown = $_POST['drop_down'];
    $city_field = $_POST['city'];
    $terms_field = $_POST['terms'];

foreach($_POST['check'] as $value) {
    $check_msg .= "Checked: $value

```

";  
}

} else {  
$body = "Full Name: $name\_field  
$check\_msg E-Mail: $email\_field  
$check\_msg Daytime Phone: $phone\_field  
$check\_msg State: $dropdown  
$check\_msg City: $city\_field  
$check\_msg Terms & Conditions: $terms\_field  
";

```
echo "Data has been submitted to $to!";
mail($to, $subject, $body);

```

} else {  
echo “blarg!”;  
}  
?\>

Thanx!
