I have build a form that do nothing else than build a url to "redirect" the user, based on form element values.
The form contains values from a taxonomy that contains the Countries and the cities of each city.
So when the user choosing a country the form building the url that send the user to the appropriate page that display all the records of this country. If the user choose and the city field, then the form building the url that send the user to the appropriate page that display the records of this country > city.
The form it is using "post" as method.
All works fine untils here !.
The problem is when the user try to refresh the results page, or try to use the back button from a subsequent page.
To fix that, I try to redirect the user after submiting the form to the same form, but I am afraid for endless redirection. For this reason I like to know if it is posible to change the modify the request method via the header()
function.
This can help me to check the $_SERVER[REQUEST_METHOD]
if it is set to POST
, thus do, the redirection.