Copy this code and paste it in your HTML
foreach($Categories as $h => $ValueC){
$checkobj = HTML_QuickForm
::createElement('checkbox', $h ,null ,utf8_encode($ValueC['category']));
if(count($CategoryGroups) > 0){
foreach ($CategoryGroups as $KeyC => $ValC) {
if($ValueC['id'] == $KeyC){
$checkobj->setChecked(true);
}
}
}
$checkboxen[] = $checkobj;
}
$form->addGroup($checkboxen, 'categ', $_lang['daten']['category'], '', true);