# Kirupa PHP contact form

**URL:** <https://forum.kirupa.com/t/kirupa-php-contact-form/154742>\
**Category:** programming\
**Created:** [July 12, 2005, 12:04pm UTC](https://forum.kirupa.com/t/kirupa-php-contact-form/154742 "2005-07-12T12:04:24Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![fifty50](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/fifty50/32/1500_2.png) [@fifty50](https://forum.kirupa.com/u/fifty50)\
**Post date:** [July 12, 2005, 12:04pm UTC](https://forum.kirupa.com/t/kirupa-php-contact-form/154742/1 "2005-07-12T12:04:24Z")

</div>

I just went through the tutorial on PHP contact forms [here](http://www.kirupa.com/web/php_contact_form.htm) but what I have a problem with is if you don’t check the checkboxes, it gives you a PHP error:

> Warning: Invalid argument supplied for foreach()

It seems that the user MUST check one of the checkboxes or they will get an error, although the email still gets sent to the specified address. The problem lies in this piece of the PHP script:

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

```

I just found a way to fix that problem and I thought I’d share it. It’s a simple modification to the script:

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

```
