title: How can i replace a string in php url
body: <p>i made a search box which use $_GET method. I search for category and size.</p>
  
  <p>When the category search submitted my url becomes:</p>
  
  <pre><code>index.php?category=1
  </code></pre>
  
  <p>through:</p>
  
  <pre><code>&lt;li class=""&gt;&lt;a href="index.php?category=&lt;?php echo $category['id']; ?&gt;"&gt;&lt;?php echo $category['name']; ?&gt;&lt;/a&gt;&lt;/li&gt;
  </code></pre>
  
  <p>When size submitted my url is:</p>
  
  <pre><code>index.php?category=1&amp;size=1
  </code></pre>
  
  <p>through:</p>
  
  <pre><code>&lt;li id=""&gt;
  &lt;a href="&lt;?php echo $_SERVER['REQUEST_URI'].'&amp;size='; ?&gt;&lt;?php echo $size['id']; ?&gt;"&gt;&lt;?php echo $size['name']; ?&gt;&lt;/a&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>When i search for another size i have:</p>
  
  <pre><code>index.php?category=1&amp;size=1&amp;size=2
  </code></pre>
  
  <p>How can i just replace the size instead of adding it again in my url?</p>