jfernandez wrote:Sorry the posting doesn't allow me to properly indent.
It does if you put your code between [php]...[/code] tags. It will even colour it for you if you do that (as you'd have seen from many of the other threads in these forums).
If you've got no control over which query string variables appear and in which order, then you might be better of constructing the entire query. PHP5 has [man]http_build_query[/man], but it's easy enough to do by hand. Something like
function build_query($names_and_values)
{
$querystring_items = array();
foreach($names_and_values as $name=>$value)
{
$querystring_items = $name."=".urlencode($value);
}
return join("&", $querystring_items);
}
$querystring = build_query(array(
'page'=>$page,
'sort'=>$_GET['sort'],
'lang'=>'en'
);
(See?)