How do i iterate over the $departments array and test to see if it equals the $name variable value and return "checked" if its in the list. departments is an array of checkboxes
function isChecked($name) {
$departments = (isset($_POST["interests"])) ? $_POST["interests"] : array();
foreach ($departments as $key => $value) {
// this next line here is wrong
if($departments[$key][$value] == $name) {
return "checked";
};
}
return "";
}