This is my code
<?php foreach ($categories as $cat) { ?>
<li>
<input id="category" name="category[]" type="checkbox" value="<?= $cat->term_id; ?>"
<?php if (isset($_GET['category'])) echo "checked='checked'"; ?>><?= $cat->name ?></input>
</li>
<?php } ?>
But when i submit the form the check boxes are all checked and what i wan't is to keep checked only the checkbox i checked not the others Example Below