Refresh 'Email with Attachments' form inputs

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() ?>
<input type="radio" name="fuehrerschein" value="nein"<?php if($value == 'nein'): ?> checked<?php endif ?>  /><?= $page->labelfuehrerschein2() ?>

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>


How do I code this to make it work?

Check out this post: Uniform plugin – Keep checkboxes status on error

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

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)

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