I am trying to change the data fetched by mysql in a table tag when a button is click. It's like filtering the data in the table by active and inactive
How about this:
<form method=POST>
<select class="form-control input-lg" name=filter onchange="this.form.submit()">
<option value="Active">Active</option>
<option value="Inactive">Inactive</option>
</select>
</form>
You could send a get request and pass a value to it to filter:
<?php
$age=""
if(isset($_GET["age"])){
$age=htmlspecialchars($_GET["age"]);
}
$query="SELECT ... FROM ... WHERE age='$age'";
//run query + output
?>
Use this link to filter
<a href="?age=18">Just show 18 year old</a>
Or this form:
<form action="thissite.php" method="get">
<select name="age" id="age">
<option value="18">18</option>
...
</select>
<button type="submit">Filter</button>
</form>