Have you not found the need to substitute some parameter of the URL from PHP?
Well, surely there are many ways to do it, but few as simple as this:
function changeURLGETParameter($parameter,$value) {
$query = $_GET;
$query[$parameter] = $value;
$query_result = http_build_query($query);
return substr($_SERVER['PHP_SELF'], 1). '?'.$query_result;
}