# PHP Mailer question

**URL:** https://forum.kirupa.com/t/php-mailer-question/209094
**Category:** Uncategorized
**Created:** [December 5, 2006, 9:40pm UTC](https://forum.kirupa.com/t/php-mailer-question/209094 "2006-12-05T21:40:26Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Soig](https://avatars.discourse-cdn.com/v4/letter/s/eada6e/32.png) [@Soig](https://forum.kirupa.com/u/Soig)
#### Post date: [December 5, 2006, 9:40pm UTC](https://forum.kirupa.com/t/php-mailer-question/209094/1 "2006-12-05T21:40:26Z")

</div>

Hey Guys, I’m having a hard time with a simple code. I got this from a website and I only eddited what I needed to. But wehn I use it, it gives me this result

> **Warning** : Invalid argument supplied for foreach() in **/home/u2xs/public\_html/magnum/php/mailer.php** on line **11**

The Entire Code is

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

```
$to = "sergio@u2xs.com"; 
$subject = "A question from $name at MT.com";
$name = $_POST['name'];
$company = $_POST['company'];
$eMail = $_POST['eMail'];
$telephone = $_POST['telephone'];
$message = $_POST['message'];
foreach($_POST['check'] as $value) {
    $check_msg .= "Checked: $value

```

";  
}

```
$body = " Name: $name
E-Mail: $eMail
Company: $company
Telephone: $telephone
Message: $message";

echo "&lt;HTML&gt;&lt;body bgcolor=0C2776 text=white&gt;&lt;font size=7&gt;Thank you&lt;/font&gt;&lt;/body&lt;/html&gt;";
mail($to, $subject, $body);

```

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

The part I believe has a mistake is this one…

> 

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

```

";  
}

Any thoughts??? Thanks
