Building query strings in PHP
<p>I'm wondering if there is a technique or function to do this or if I'm just going to have to have a ton of IF statements/arrays here-</p>

<p>I have a page called products.php and a few different filters I add in the query string.
All the filters (if chosen) could look like this:</p>

<pre><code>products.php?cat=chairs&amp;type=pine&amp;search=Vienna+Range
</code></pre>

<p>Is there a simple way to build the query for use again?</p>

<p>I'm going to have buttons/a search box to change the filters I'm using, so will I have to build the URL and query up again for each filter?</p>

<p>For example I'd like to have:</p>

<pre><code>&lt;a href="products.php?cat=tables"&gt;Tables&lt;/a&gt;
&lt;a href="products.php?cat=beds"&gt;Beds&lt;/a&gt;
&lt;a href="products.php?cat=chairs"&gt;Chairs&lt;/a&gt;
</code></pre>

<p>but also build the query so that it remembers my search term, wood type and range; so clicking on "Tables" would take me to</p>

<pre><code>products.php?cat=chairs&amp;type=pine&amp;search=Vienna+Range.
</code></pre>
