Okay. I'm trying to wrap my head around this. See if i've got this right.
Your post values contain 'category', which is an array of category ID's that should be checked.
It also contains 'count', which is the total number of categories.
Your intention is to create an array of HTML tags which have a key of 0..count and the corresponding checked/not-checked HTML.
PHP Code:
$count = (isset($_POST['count'])) ? (int) $_POST['count'] : 0;
$span = range(0,$count);
$html = array();
foreach($span as $key) {
$html[] = "<input type='checkbox' value='$key' ".((in_array($_POST['category'],$key)) ? 'checked' : '').">";
}
should... do what you wanted?
Bookmarks