I get the information of my database into a table on my website. I sort my table when I click the link below, but I'd like to undo the sorting by clicking the same link again.
How do I do that? I researched rsort
& unsset
but I just can't get the solution.
For example I have a table with the tableheader "firstname" which contains all the names of course. When I click "firstnames", it sorts the firstnames.
$sqli = "SELECT * FROM data_base"
if ($_GET['sort'] == 'firstname')
{
$sqli .= " ORDER BY firstname ASC";
}
<th><a href=\"test.php?sort=firstname\">Firstname</a></th>