Hello, I have a couple of questions about url variables.
There is a page with url index.php?id=2 .

Question 1. How to add a new variable to the current url, that is, to do something like this:
index.php?sort=price to end up with 'index.php?id=2&sort=price .

Question 2 . Can this be done without reloading the page?

    1 answer 1

    Question 1.

    Take the current URL, add the desired stock:

     $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]"; $actual_link .= "&sort=price"; 

    Question 2.

    with php - no. (but you can through Ajax)