I would like to get all checked checkboxes in a form, so if there were a list of checkboxes with the values 'a', 'b', 'c' and 'd' and only checkbox 'a' and 'c' were checked, my query would only select 'a' and 'c' from the desired table.
What would be the simplest way of accomplishing this prefferably in PHP?
EDIT: After retrieving which checkboxes were checked, i want to use those in my MySQLI Query.
So if for example the result is 'c','d','e' the query should look like this:
$query = "SELECT 'c', 'd', 'e' FROM table";
How would i translate the results to this?
I tried using the sample from a similar question: https://stackoverflow.com/a/4997271/5453484
Edit 2: More code:
<form name="filter" style="float:left;" method="post">
<table>
<tr>
<td>
<label>Voornaam:</label>
</td>
<td>
<input type="checkbox" name="check_list[]" value="a"/>
</td>
</tr>
<tr>
<td>
<label>Achternaam:</label>
</td>
<td>
<input type="checkbox" name="check_list[]" value="b"/>
</td>
</tr>
<tr>
<td>
<label>Adres</label>
</td>
<td>
<input type="checkbox" name="check_list[]" value="c"/>
</td>
</tr>
<tr>
<td>
<label>Plaats</label>
</td>
<td>
<input type="checkbox" name="check_list[]" value="d"/>
</td>
</tr>
<tr>
<td>
<label>Postcode</label>
</td>
<td>
<input type="checkbox" name="check_list[]" value="e"/>
</td>
</tr>
<tr>
<td>
<label>Zoeken</label>
</td>
<td>
<input type="text" name="Zoeken" value="f"/>
</td>
</tr>
<tr>
<td>
<label style="margin-top:5px;"></label>
</td>
<td>
<input id="submitfilter" type="submit" style="margin-top:5px;" class="btn">Zoeken</input>
</td>
</tr>
</table>
<?php
if(!empty($_POST['check_list'])) {
foreach($_POST['check_list'] as $check) {
echo $check; //echoes the value set in the HTML form for each checked checkbox.
//so, if I were to check 1, 3, and 5 it would echo value 1, value 3, value 5.
//in your case, it would echo whatever $row['Report ID'] is equivalent to.
}
}
?>
</form>
This is the form i use at the moment.