0

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?

3
  • You will always be able to get that myparameter in $_POST. explain me what are you trying to do? Commented Oct 24, 2014 at 5:11
  • check if any javascript operates in this form, maybe through javascript (or jquery) your get param becomes post param. Commented Oct 24, 2014 at 5:31
  • have you considered to use $.ajax of jquery to submit the form instead of the classic way ? Commented Apr 14, 2016 at 0:02

1 Answer 1

2

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..

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

2 Comments

Is your current page already including paramater in the url like mine index.php?page=21 ?
This should not be an answer. This is a comment on question.

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.