I'm trying to add checkboxes to each cell in my table. If $columns['mything$record'] is equal to 1, I want a checkbox that's checked to show up. If $columns['mything$record'] is equal to 0, I want a blank checkbox to show up. I've created if statements which one can view below, but they don't put a checkbox in each table cell with the respective value, only one blank checkbox appears at the top of the page. How can I put checkboxes in each cell that are checked and unchecked based on the cell value?
$columns = array(
1 => array(
"selectFieldName" => "nrs.record nrRecord",
"resultFieldName" => "nrRecord",
"headerName" => "NT#",
"defaultSortOrder" => -1,
),
array(
"selectFieldName" => "nrs.title",
"resultFieldName" => "title",
"headerName" => "Title",
"defaultSortOrder" => 1,
),
);
$selectedColumnNumbers = array(1,2,3);
$counter=4;
foreach($shortNameArray as $record=>$name){
if($record>0){
$columns[]=array(
"selectFieldName" => "CASE WHEN $record IN (GROUP_CONCAT(dm_nr_links.dmRecord)) THEN 1 ELSE 0 END mything$record",
"resultFieldName" => "mything$record",
"headerName" => "$name",
"defaultSortOrder" => 1,
);
$selectedColumnNumbers[]=$counter;
$counter++;
if ($columns['mything$record'] == 1) {
echo "<input type='checkbox' name='PLJan' ";
echo "checked='checked'";
}
if ($columns['mything$record'] == 0) {
echo "<input type='checkbox' name='JLFeb' ";
}
}
}
Aucun commentaire:
Enregistrer un commentaire