I have an sql query that I'm echoing out as a table using php.
$query="SELECT Name,
Location,
ID,
Price
From ProdTable
where ID>=2300;"
$results = mysql_query($query);
while ($row = mysql_fetch_array($results)) {
echo '<tr>';
foreach($row as $field) {
echo '<td>' . htmlspecialchars($field) . '</td>';
}
echo '</tr>';
}
What I want to do now is be able to filter the table using check boxes (showing all locations on default and then allowing the user to filter them as he/she pleases), like so:
<input type="checkbox" name="location" value="newyork">New York
<input type="checkbox" name="location" value="chicago">Chicago
<input type="checkbox" name="location" value="orlando">Orlando
<input type="checkbox" name="location" value="losangeles">Los Angeles
But I want to do this through javascript so it's more dynamic and the user wouldn't need to press submit in order for the filtering to take place. I know there are already javascript toolkits out there for filtering, but I wanted to write a few javascript functions myself.
Any guidance is greatly appreciated.