# Refresh 'Email with Attachments' form inputs

**URL:** <https://forum.getkirby.com/t/refresh-email-with-attachments-form-inputs/17461>\
**Category:** Questions\
**Created:** [February 29, 2020, 3:57pm UTC](https://forum.getkirby.com/t/refresh-email-with-attachments-form-inputs/17461 "2020-02-29T15:57:08Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gert](https://avatars.discourse-cdn.com/v4/letter/g/7bcc69/32.png) [@Gert](https://forum.getkirby.com/u/Gert)\
**Post date:** [February 29, 2020, 3:57pm UTC](https://forum.getkirby.com/t/refresh-email-with-attachments-form-inputs/17461/1 "2020-02-29T15:57:08Z")

</div>

How can I set up the form of “Email with attachments” so that the data of checkbox and radio inputs are displayed again in case of a refresh?

I have tried the following code that didn’t work:

For radio inputs:

```
<div class="form-element">
        
        <?php $value = $form->$data['fuehrerschein'] ?? null ?>

	      <label><?= $page->labelfuehrerschein() ?> 
    <input type="radio" name="fuehrerschein" value="ja"<?php if($value == 'ja'): ?> checked<?php endif ?> /><?= $page->labelfuehrerschein1() ?>
    		</label>
    		<label>
<input type="radio" name="fuehrerschein" value="nein"<?php if($value == 'nein'): ?> checked<?php endif ?> /><?= $page->labelfuehrerschein2() ?>
			</label>
			
			
    </div>

```

and for the checkbox:

```
<div class="form-element">
				 
				 <?php $value = $form->$data['datenschutz'] ?? null ?>

	      <div class="datenschutztext"><?= $page->labeldatenschutztxt()->blocks() ?> </div>
          <label class="custom-control fill-checkbox">
			<input type="checkbox" id="datenschutz" name="datenschutz" class="fill-control-input" value="true"<?php if($value == 'true'): ?> checked<?php endif ?> >
			<span class="fill-control-indicator"></span>
		</label>
		

      </div>

```

How do I code this to make it work?

---

<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:** [February 29, 2020, 8:12pm UTC](https://forum.getkirby.com/t/refresh-email-with-attachments-form-inputs/17461/2 "2020-02-29T20:12:48Z")

</div>

Check out this post: [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:** ![Gert](https://avatars.discourse-cdn.com/v4/letter/g/7bcc69/32.png) [@Gert](https://forum.getkirby.com/u/Gert)\
**Post date:** [March 3, 2020, 12:05am UTC](https://forum.getkirby.com/t/refresh-email-with-attachments-form-inputs/17461/3 "2020-03-03T00:05:34Z")

</div>

I think there’s been a misunderstanding. This isn’t a uniform form, it’s the one from the Cookbook page

> **[Email with attachments](https://getkirby.com/docs/cookbook/forms/email-with-attachments)**
>
> Send an email with attachments from form input.

---

<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:** [March 3, 2020, 8:28am UTC](https://forum.getkirby.com/t/refresh-email-with-attachments-form-inputs/17461/4 "2020-03-03T08:28:10Z")

</div>

The code is not uniform specific, you only have to swap `$_POST['topics']`(which is basic HTML) with `$data['topics']` (or whatever that field name is)

---

<div class="post-metadata">

**Author:** ![Gert](https://avatars.discourse-cdn.com/v4/letter/g/7bcc69/32.png) [@Gert](https://forum.getkirby.com/u/Gert)\
**Post date:** [March 3, 2020, 6:40pm UTC](https://forum.getkirby.com/t/refresh-email-with-attachments-form-inputs/17461/5 "2020-03-03T18:40:57Z")

</div>

Thanks.  
I had to leave out the square brackets in ‘name=“example[]”’ for the radio inputs, otherwise it resulted in an error.
