Download a zip folder of selected files

remove the brackets from your name=”checked”
It should just be <input type="checkbox" name="checked" value="<?php echo $path; ?>">

Which would only return one value, so you cant do a foreach loop on one value. You need multiple input fields and then put those values into an array to use in the foreach loop