0

I am appending the values to url in order to pass them to a next page using tag. I want to remove those appended values once I access them on the next page without reloading the page. Is there anyway to do that in php? I want to display the updated url in the browser.

3
  • 2
    To change what appears in the browser's address bar will always require a reload. Perhaps you should POST instead of GET? Commented May 13, 2013 at 0:27
  • @MichaelBerkowski : So there is no way to change the url appearing in the browser without reloading the page. Commented May 13, 2013 at 0:32
  • 1
    No, because that would enable any site to masquerade as any other site by modifying the address bar :) Non-ideal situation. Commented May 13, 2013 at 0:33

2 Answers 2

1

Use parse_url() to split the URL into its components and put the components that you want back together to form the new URL.

If you want to modify the query string, call parse_str() on it, passing an array as second parameter, and modify that array.

Sign up to request clarification or add additional context in comments.

2 Comments

As per the comments above this will require the reloading the page.
Manipulating PHP strings does not require reloading the page. Manipulating the contents of the address bar does, but I see no indication that the OP wants to manipulate the contents of the address bar.
0
str_replace ( $search-param ,  $replace-param , $subject [, int &$count ] )

or use parse_url()

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.