user1397595
user1397595

Reputation: 147

Using POST Method in PHP Form but the Parameters Appear in the URL

My current page is index.php?page=21. In that page I have a form with POST method to post myParamater so that it won't appear in the URL.

<form method="POST" action="index.php?page=21">
      <input name="myParamater" type="hidden" value="1">
      <input type="submit" value="Go">
</form>

When I click my submit button, something strange happens. It brings me to index.php?myParamater=1. And also when I change my form to

<form method="POST" action="self">
      <input name="page" type="hidden" value="21">
      <input name="myParamater" type="hidden" value="1">
      <input type="submit" value="Go">
</form>

It brings me to index.php?page=21&myParamater=1

What should I do so I can redirect to my current page (index.php?page=21) with new paramater myParameter without make myParamater appear in the URL?

Upvotes: 0

Views: 1612

Answers (1)

N Kumar
N Kumar

Reputation: 1312

It looks like your method post is not working and it is using GET method by default. I tried it in my browser and it works correctly.. Try using other browser.. or reload it..

Upvotes: 2

Related Questions