John Nikko Cruz John Nikko Cruz - 4 months ago 5x
PHP Question

How can i change the content a table tag in html with values retrieved from database upon filtering it with buttons

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


You could send a get request and pass a value to it to filter:

$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>
<button type="submit">Filter</button>