Martin
Martin

Reputation: 45

Unique URL for POST submission

I am an inexperienced amateur web developer, so please forgive me if I'm missing an obvious solution to this problem.

My website consists of a search form that is used to search through information I've made available in a static database. There are several parameters in the search form, so the form uses POST to send the parameters to the page. When a valid search occurs, the parameters of the search are logged in a mySQL table with an associated unique auto-incremented ID. When the results are displayed, a link of the form index.php?id=100&page=1 is also displayed so the search can be accessed again without re-inputting the parameters.

However, since POST is used to send the parameters, the URL after the search remains index.php. Is there any way I can send that unique ID to the URL after the search so that the URL after the search is displayed as index.php?id=100&page=1?

Upvotes: 0

Views: 136

Answers (1)

lsowen
lsowen

Reputation: 3838

Yes, either of the following will accomplish what you want:

  1. Use a GET request rather than a POST request.
  2. Have the server redirect the user to a new page which has the parameters in the GET string. (See https://stackoverflow.com/a/768472/3108853 for details on redirecting).

Upvotes: 3

Related Questions