I have a list of articles on my page, and I would like to be able to apply a myriad of sorts and filters to it by appending $_GET values to the URL:
http://www.example.com/blogs.php?sort=newest&popularity=high&length=200
If I have links on my page to append these values to the url...they need to be smart enough to account for any previous sorts/filters applied.
EXAMPLE 1:
if i currently have... http://www.example.com/blogs.php?sort=newest
and then i want to attach an additional filter of popularity=high, i need to have this:
http://www.example.com/blogs.php?sort=newest&popularity=high
and not this:
http://www.example.com/blogs.php?popularity=high
EXAMPLE 2:
if i have... http://www.example.com/blogs.php?popularity=high
and i try to alter my popularity filter, i do not want:
http://www.example.com/blogs.php?popularity=high&popularity=low
so simply tacking on to the query string won't fly.
Therefore, what is a scalable way to build my filter links so that they "remember" old filters, but will still overwrite their own filter value when needed?