I want to show column from the checked data. For example, I checked Lump and Web Break so there's only column Lump and Web Break. I searching about this but i cant found it.
heres my code for checkbox
</div>
<label>Select Defect</label>
<table>
<tr>
<td width='300px'><p><input type="checkbox" name="chk[]" value=".1"> Big Hole</p>
<p><input type="checkbox" name="chk[]" value=".2"> Big Pin Hole</p>
<p><input type="checkbox" name="chk[]" value=".3"> Detection Off</p>
<p><input type="checkbox" name="chk[]" value=".4"> Extreme Hole</p>
<p><input type="checkbox" name="chk[]" value=".5"> Pin Hole</p>
</td>
<td width='300px'><p><input type="checkbox" name="chk[]" value=".6"> Pin Light Spot</p>
<p><input type="checkbox" name="chk[]" value=".7"> Small Hole</p>
<p><input type="checkbox" name="chk[]" value=".8"> Uninspected</p>
<p><input type="checkbox" name="chk[]" value=".9"> Very Small Dark Spot</p>
<p><input type="checkbox" name="chk[]" value=".10"> Very Small Light Spot</p>
</td>
<td width='300px'><p><input type="checkbox" name="chk[]" value=".11"> Web Break</p>
<p><input type="checkbox" name="chk[]" value=".12"> Filter Small</p>
<p><input type="checkbox" name="chk[]" value=".13"> Edge Filter Small</p>
<p><input type="checkbox" name="chk[]" value=".14"> Filter Light Spot</p>
<p><input type="checkbox" name="chk[]" value=".15"> Mini Dark Spot</p>
</td>
<td width='300px'><p><input type="checkbox" name="chk[]" value=".16"> Small Dark Spot</p>
<p><input type="checkbox" name="chk[]" value=".17"> Lump</p>
<p><input type="checkbox" name="chk[]" value=".18"> Intensity Filter</p>
<p><input type="checkbox" name="chk[]" value=".19"> Big Dark Spot</p>
<p> </p>
</td>
</table>
</div>
here's datatable
<thead>
<th class="text-center" >Date Process</th>
<th class="text-center" >Big Hole</th>
<th class="text-center">Big Pin Hole</th>
<th class="text-center" >Detection Off</th>
<th class="text-center" >Extreme Hole</th>
<th class="text-center" >Pin Hole</th>
<th class="text-center" >Pin Light Spot</th>
<th class="text-center" >Small Hole</th>
<th class="text-center" >Uninspected</th>
<th class="text-center" >Very Small Dark Spot</th>
<th class="text-center" >Very Small Light Spot</th>
<th class="text-center" >Web Break</th>
<th class="text-center" >Filter Small</th>
<th class="text-center" >Edge Filter Small</th>
<th class="text-center" >Filter Light Spot</th>
<th class="text-center" >Mini Dark Spot</th>
<th class="text-center" >Small Dark Spot</th>
<th class="text-center" >Lump</th>
<th class="text-center" >Intensity Filter</th>
<th class="text-center" >Big Dark Spot</th>
</thead>
I get the data from database and using join
<?php
$no = 0;
$modal=mysqli_query($mysqli,"
SELECT t_name_file.PROCESS_TIME,
COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 1 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `1`,
COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 2 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `2`,
COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 3 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `3`,
COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 4 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `4`,
COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 5 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `5`,
COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 6 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `6`,
COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 7 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `7`,
COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 8 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `8`,
COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 9 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `9`,
COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 10 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `10`,
COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 11 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `11`,
COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 12 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `12`,
COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 13 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `13`,
COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 14 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `14`,
COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 15 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `15`,
COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 16 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `16`,
COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 17 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `17`,
COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 18 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `18`,
COUNT(CASE t_transaction.DEFECT_CLASS_ID WHEN 19 THEN t_defect_class.DEFECT_CLASS_NAME END) AS `19`
FROM t_transaction
INNER JOIN t_name_file ON t_transaction.NAMEFILE_ID=t_name_file.NAMEFILE_ID
INNER JOIN t_defect_class ON t_transaction.DEFECT_CLASS_ID=t_defect_class.DEFECT_CLASS_ID
GROUP BY t_transaction.DEFECT_CLASS_ID, t_name_file.PROCESS_TIME ORDER BY t_name_file.PROCESS_TIME");
while($defect=mysqli_fetch_array($modal)){
$no++;
?>
<tr>
<td class="text-center"><?php echo $defect['PROCESS_TIME']; ?></td>
<td class="text-center"><?php echo $defect['1']; ?></td>
<td class="text-center"><?php echo $defect['2']; ?></td>
<td class="text-center"><?php echo $defect['3']; ?></td>
<td class="text-center"><?php echo $defect['4']; ?></td>
<td class="text-center"><?php echo $defect['5']; ?></td>
<td class="text-center"><?php echo $defect['6']; ?></td>
<td class="text-center"><?php echo $defect['7']; ?></td>
<td class="text-center"><?php echo $defect['8']; ?></td>
<td class="text-center"><?php echo $defect['9']; ?></td>
<td class="text-center"><?php echo $defect['10']; ?></td>
<td class="text-center"><?php echo $defect['11']; ?></td>
<td class="text-center"><?php echo $defect['12']; ?></td>
<td class="text-center"><?php echo $defect['13']; ?></td>
<td class="text-center"><?php echo $defect['14']; ?></td>
<td class="text-center"><?php echo $defect['15']; ?></td>
<td class="text-center"><?php echo $defect['16']; ?></td>
<td class="text-center"><?php echo $defect['17']; ?></td>
<td class="text-center"><?php echo $defect['18']; ?></td>
<td class="text-center"><?php echo $defect['19']; ?></td>
</td>
</tr>
<?php } ?>
</div>
It works when i try to filter the column but not for fields.