Well, I had same problem, found this question, and, in the end, prefered my own method. Maybe it has flaws, then please tell me what are they.
My solution is:
$query=$_GET;
$query['YOUR_NAME']=$YOUR_VAL;
$url=$_SERVER['PHP_SELF']. '?' . http_build_query($query);
Hope it helps.