# Php contact me form problem

**URL:** https://forum.kirupa.com/t/php-contact-me-form-problem/321464
**Category:** Uncategorized
**Created:** [April 20, 2011, 2:08pm UTC](https://forum.kirupa.com/t/php-contact-me-form-problem/321464 "2011-04-20T14:08:39Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![vimalT](https://avatars.discourse-cdn.com/v4/letter/v/3da27b/32.png) [@vimalT](https://forum.kirupa.com/u/vimalT)
#### Post date: [April 20, 2011, 2:08pm UTC](https://forum.kirupa.com/t/php-contact-me-form-problem/321464/1 "2011-04-20T14:08:39Z")

</div>

Hello, im having a problem with the form…i keep getting the error message :

**Notice** : Undefined variable: check\_msg in **C:\xampp\htdocs\website\mailer.php** on line **13**  
Data has been submitted to [vimaltailor@hotmail.com](mailto:vimaltailor@hotmail.com)!  
**Warning** : mail() [[function.mail](http://localhost/website/function.mail)]: “sendmail\_from” not set in php.ini or custom “From:” header missing in **C:\xampp\htdocs\website\mailer.php** on line **20**

Code mailer.php

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

```
$to = "vimaltailor@hotmail.com"; 
$subject = "Form Tutorial";
$name_field = $_POST['name'];
$email_field = $_POST['email'];
$message = $_POST['message'];
$option = $_POST['radio'];
$dropdown = $_POST['drop_down'];

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

```

";  
}

```
$body = "From: $name_field

```

E-Mail: $email\_field  
$check\_msg Option: $option  
Drop-Down: $dropdown  
Message:  
$message  
";

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

```

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

Contact.htm

\<html\>  
\<head\>  
\<meta http-equiv=“Content-Language” content=“en-us”\>  
\<meta http-equiv=“Content-Type” content=“text/html; charset=windows-1252”\>  
\<title\>New Page 1\</title\>  
\</head\>  
\<body\>  
\<form method=“POST” action=“mailer.php”\>  
Name:  
\<input type=“text” name=“name” size=“19”\>  
\<br\>  
\<br\>  
E-Mail:  
\<input type=“text” name=“email” size=“19”\>  
\<br\>  
\<br\>  
\<input type=“checkbox” name=“check[]” value=“blue\_color”\>  
River Building\<br\>  
\<input type=“checkbox” name=“check[]” value=“green\_color”\>  
Marlborough House\<br\>  
\<input type=“checkbox” name=“check[]” value=“orange\_color”\>  
Wellington Street\<br\>  
\<br\>  
\<input type=“radio” value=“yes” name=“radio”\>  
YES\<br\>  
\<input type=“radio” value=“no” name=“radio”\>  
NO \<br\>  
\<br\>  
\<select size=“1” name=“drop\_down”\>  
\<option\>Rent\</option\>  
\<option\>Location\</option\>  
\<option\>General\</option\>  
\</select\>  
\<br\>  
\<br\>  
Message:\<br\>  
\<textarea rows=“9” name=“message” cols=“30”\>\</textarea\>  
\<br\>  
\<br\>  
\<input type=“submit” value=“Submit” name=“submit”\>  
\</form\>  
\</body\>  
\</html\>
