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.

3
  • 2
    Make them POST parameters instead Commented Dec 24, 2015 at 23:10
  • I think we need more clarification on what you're trying to achieve. It's easy to make assumptions here. Commented Dec 24, 2015 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 Commented Dec 25, 2015 at 0:18

3 Answers 3

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.

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

10 Comments

here is what my form looks like <form style=" margin-left: 10px;" id="vehicle" action="iar7.php" style="padding-left:30px;color:#fff"> so if edit that in to <form Method='POST' style=" margin-left: 10px;" id="vehicle" action="iar7.php" style="padding-left:30px;color:#fff"> will fix it?
simply add method='post' and it should send the parameters in the body instead of url!
I think you should mention that you need to use $_POST to obtain the query parameters.
as Willem mentioned, you will need to use $_POST to access the parameters by name, for example $_POST['size']
@Pabs123 Yes that works but i have also use this link on the page which takles you to the next page which still shows `echo"<div id='link' style='color:#fff '><a id='' style='color:#000;' href='iardetailt.php?sid=".$row['Auto_PN']."&i2t1=".$_REQUEST['2t1']."&i2t2=".$_REQUEST['2t2']."&i2t3=".$i2t3."&i2t4=".$i2t4."&smallrc=".$minrc."&largerc=".$maxrc."&rearsw=".$row['SW']."'>";echo'<button type="button" class="btn btn-success">Select</button>';echo"</div></td>"; How can i update that
|
2

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

<form method='post' action='/someurl'>
...

Comments

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.

Comments

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.