php get all url variables

The superglobal entry $_SERVER['QUERY_STRING'] has the query string in it. You could just append that to any further links.

update: The alternate response on this page using http_build_query is better because it lets you add new variables to the query string without worrying about extraneous ?s and such. But I’ll leave this here because I wanted to mention that you can access the literal query string that’s in the current address.

Leave a Comment