Uniform plugin – Keep checkboxes status on error

I just realized that your problem is the name of your inputs, should be

name="topics[]"

In the end it should look something like this:

<input type="checkbox" name="topics[]" id="blue" value="blue" <?= isset($_POST['topics']) && in_array('blue', $_POST['topics']) ? 'checked':'' ?> />
<label for="blue">Blue</label>

<input  type="checkbox" name="topics[]"  id="green" value="green" <?= isset($_POST['topics']) && in_array('green', $_POST['topics']) ? 'checked':'' ?> />
<label for="green">Green</label>

<input  type="checkbox" name="topics[]"  id="red" value="red" <?= isset($_POST['topics']) && in_array('red', $_POST['topics']) ? 'checked':'' ?> />
<label for="red">Red</label>

<input type="checkbox" name="topics[]"  id="black" value="black" <?= isset($_POST['topics']) && in_array('black', $_POST['topics']) ? 'checked':'' ?> />
<label for="black">Black</label>
</div>
<input type="submit" name="submit" value="Submit">

Guess you can then also use $form->old('topics') instead of `$_POST[‘topics]’ because that should now return an array.