I am trying to create a filter tab for my table that will have a few different options when clicked filter the data from the table and display a new set of results, a single selection from each drop down will then filter table results. Have tried a few tutorials to no avail(I am a beginner with PHP, js)
Here is my code;
Display Table on page;
<?php
$con=mysqli_connect("localhost","root", "", "database");
// Check connection
if (mysqli_connect_errno())
{
echo "Failed to connect to MySQL: " . mysqli_connect_error();
}
$result = mysqli_query($con,"SELECT * FROM table GROUP BY id DESC LIMIT 25");
if (!$result) {
printf("Error: %s
", mysqli_error($con));
exit();
}
echo "<table border='5' class='table'>
<tr>
<th>Game ID</th>
<th>Game Name</th>
<th>Category</th>
<th>Suggested LVL</th>
<th>Insert Date</th>
</tr>";
while($row = mysqli_fetch_array($result))
{
echo "<tr>";
echo "<td>" . $row['id'] . "</td>";
echo "<td>" . $row['gamename'] . "</td>";
echo "<td>" . $row['gamecategory'] . "</td>";
echo "<td>" . $row['gamelevel'] . "</td>";
echo "<td>" . $row['listdate'] . "</td>";
echo "</tr>";
}
echo "</table>";
?>
What I would like the filter to be like; It is just an example, and the cars have nothing to do with my game database.
<div class="input-group">
<select>
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
</div>
Im just kind of stumped on where to go from here, is there any handy free jquery plugins, AJAX, or any other options?
Thanks for the help