0

How can I hide the PHP GET parameters from a URL?

Here is how the URL looks like

../iar7.php?size1=&size=TURF&R3=R3&txtsize=&txttreadd=&small=&large=&smallsw=&largesw=&smallrc=&largerc=&scc=&lcc=&2t1=&2t2o=&2t3o=&2t1=1.36&2t2=1&2t3=5

I want to show only ../iar7.php.

Willem Van Onsem
  • 443,496
  • 30
  • 428
  • 555
user5225773
  • 125
  • 1
  • 9
  • 2
    Make them POST parameters instead – Mark Baker Dec 24 '15 at 23:10
  • I think we need more clarification on what you're trying to achieve. It's easy to make assumptions here. – Scuzzy Dec 24 '15 at 23:17
  • although you had some follow up questions, I would appreciate if you could accept my answer since it fixed the problem you described in your original question – Pabs123 Dec 25 '15 at 00:18

3 Answers3

8

Since you're using a GET, all your payload will be shown as query params. If you would like to hide them perhaps try using a POST instead.

You can read up on some of the differences between the methods here.

Willem Van Onsem
  • 443,496
  • 30
  • 428
  • 555
Pabs123
  • 3,385
  • 13
  • 29
2

If you are using forms, your html form would look like this:

<form method='post' action='/someurl'>
...
jsdeveloper
  • 3,945
  • 1
  • 15
  • 14
2

As already said before, there are two methods to send data: using GET (which is encoded in the URL), or using POST which means the data is sended as additional payload in the HTTP request. You cannot hide the URL parameters from the GET request method, simply because it is the way GET is supposed to work.

You can do this by specifying this in your <form> tag in the HTML source code:

<form action='the.url.com/path/file.php' method='post'>
    <!-- ... -->
</form>

Furthermore I want to add that you have to note that in order to process the data in your PHP file, you will have to call $_POST instead of $_GET.

Willem Van Onsem
  • 443,496
  • 30
  • 428
  • 555