# Kirby Uniform Plugin: Multiple Checkbox

**URL:** https://forum.getkirby.com/t/kirby-uniform-plugin-multiple-checkbox/13955
**Category:** Questions
**Tags:** v3
**Created:** [April 26, 2019, 1:12pm UTC](https://forum.getkirby.com/t/kirby-uniform-plugin-multiple-checkbox/13955 "2019-04-26T13:12:36Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![MSchaffer](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mschaffer/32/6190_2.png) [@MSchaffer](https://forum.getkirby.com/u/MSchaffer)
#### Post date: [April 26, 2019, 1:12pm UTC](https://forum.getkirby.com/t/kirby-uniform-plugin-multiple-checkbox/13955/1 "2019-04-26T13:12:36Z")

</div>

Hey there,

I am trying to setup a checkbox with the uniform plugin, that sends multiple values, when they are checked. Unfortunately I cannot get it work. Is this even possible?

Thanks  
Matthias

---

<div class="post-metadata">

### Author: ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)
#### Post date: [April 26, 2019, 1:57pm UTC](https://forum.getkirby.com/t/kirby-uniform-plugin-multiple-checkbox/13955/2 "2019-04-26T13:57:19Z")

</div>

Check out this: [Uniform plugin – Keep checkboxes status on error](https://forum.getkirby.com/t/uniform-plugin-keep-checkboxes-status-on-error/13915/12)

---

<div class="post-metadata">

### Author: ![MSchaffer](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mschaffer/32/6190_2.png) [@MSchaffer](https://forum.getkirby.com/u/MSchaffer)
#### Post date: [April 26, 2019, 2:05pm UTC](https://forum.getkirby.com/t/kirby-uniform-plugin-multiple-checkbox/13955/3 "2019-04-26T14:05:36Z")

</div>

@texnixe

Thanks for your reply. It is still not sending.

I registered the fields like this:

```
  $form = new Form([
// Fields
'type' => [],

```

]);

And then in the template:

```
      <ul class="contactForm__type">
        <?php $value = $form->old('type') ?>
        <li>
          <input type="checkbox" id="buero" name="type[]" value="Büroreinigung"<?php e($form->value('Büroreinigung'), ' checked')?>/>
          <label for="buero">Büroreinigung</label>
        </li>
        <li>
          <input type="checkbox" id="glass" name="type[]" value="Glasreinigung"<?php e($form->value('Glasreinigung'), ' checked')?>/>
          <label for="glass">Glasreinigung</label>
        </li>
      </ul>

```

The email template looks currently like this:  
\<?php

```
if (array_key_exists('type', $form)) {
    foreach ($form['type'] as $key => $value) {
    echo $value . "\n";
}
} else {
    echo 'Nichts ausgewählt!' . "\n" . "\n";
}

```

It is simply reloading the form page, instead of sending the mailform and forwarding to the thanks-page. Any ideas?

---

<div class="post-metadata">

### Author: ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)
#### Post date: [April 26, 2019, 2:11pm UTC](https://forum.getkirby.com/t/kirby-uniform-plugin-multiple-checkbox/13955/4 "2019-04-26T14:11:47Z")

</div>

Hm, I only tested a quick example without Uniform, so I have to install that first. I’ll try to look into this later.

---

<div class="post-metadata">

### Author: ![MSchaffer](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mschaffer/32/6190_2.png) [@MSchaffer](https://forum.getkirby.com/u/MSchaffer)
#### Post date: [April 26, 2019, 2:17pm UTC](https://forum.getkirby.com/t/kirby-uniform-plugin-multiple-checkbox/13955/5 "2019-04-26T14:17:40Z")

</div>

Thank you!

---

<div class="post-metadata">

### Author: ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)
#### Post date: [April 26, 2019, 2:58pm UTC](https://forum.getkirby.com/t/kirby-uniform-plugin-multiple-checkbox/13955/6 "2019-04-26T14:58:36Z")

</div>

Could you quickly post your complete controller and form for testing?

We are talking Kirby 3, right?

---

<div class="post-metadata">

### Author: ![texnixe](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/texnixe/32/5754_2.png) [@texnixe](https://forum.getkirby.com/u/texnixe)
#### Post date: [April 26, 2019, 4:21pm UTC](https://forum.getkirby.com/t/kirby-uniform-plugin-multiple-checkbox/13955/7 "2019-04-26T16:21:05Z")

</div>

I did a quick test and in my example, the data is sent.

For the form to show the checked values, I had to make the following changes:

```auto
<?php $value = $form->old('type') !== '' ? $form->old('type') : [] ?>
<ul class="contactForm__type">

        <li>
          <input type="checkbox" id="buero" name="type[]" value="Büroreinigung" <?= in_array('Büroreinigung', $value)? 'checked':'' ?>/>
          <label for="buero">Büroreinigung</label>
        </li>
        <li>
          <input type="checkbox" id="glass" name="type[]" value="Glasreinigung" <?= in_array('Glasreinigung', $value)? 'checked':'' ?>/>
          <label for="glass">Glasreinigung</label>
        </li>
</ul>

```

Looks a bit ugly but seems to work.

---

<div class="post-metadata">

### Author: ![MSchaffer](https://dub1.discourse-cdn.com/flex017/user_avatar/forum.getkirby.com/mschaffer/32/6190_2.png) [@MSchaffer](https://forum.getkirby.com/u/MSchaffer)
#### Post date: [April 26, 2019, 7:32pm UTC](https://forum.getkirby.com/t/kirby-uniform-plugin-multiple-checkbox/13955/8 "2019-04-26T19:32:33Z")

</div>

@texnixe  
Awesome - it works! Thanks a lot for looking into it and the great support.

Best  
Matthias
