Reputation: 767
after submitting a form I get redirected to the same page because I settled the form action as $_SERVER['PHP_SELF']
but I've got the problem I need to be redirected to the full url which pass the id and cat GET variables.
I think I can easily solve it by adding to the server variable something like
.'?id='.$_GET['id'].'&cat='.$_GET['cat']
but I would like to know if there is something similar to PHP_SELF
, but which keep the full url with the GET variables.
Upvotes: 0
Views: 6408
Reputation: 93
The form submit to the current page by default. You could try:
<form action="" method="GET">
<input type="hidden" name="id" value="some"/>
<input type="hidden" name="cat" value="value"/>
</form>
domain.com/?id=some&cat=value
Upvotes: 1
Reputation: 1
Change the sending method of the form from POST to GET. http://www.w3schools.com/tags/att_form_method.asp
Upvotes: 0
Reputation: 157
You can just put an empty form action like in the following example:
<form action="" method="POST">
All GET parameters will be preserved
Upvotes: 5