DaftPlug
DaftPlug

Reputation: 60

Hide specific part of passed parameters in URL

I am passing multiple parameters in select form with GET method. I want to hide 3 from 4 parameters in URL after form submit. I have an options with 4 values and the I explode them and get each like that:

<select name="hardware">
<option value="Bitmain AntMiner S9|1-btc-sha-256|14000|1375">BITMAIN AntMiner S9</option>
<option value="Bitmain AntMiner D3|34-dash-x11|15000|1200">BITMAIN AntMiner D3</option>
</select>

<?php 
$hardware = $_GET["hardware"];
$hardware_explode = explode('|', $hardware);
echo $hardware_explode[0];
echo $hardware_explode[1];
echo $hardware_explode[2];
echo $hardware_explode[3];
?>

in URL it is like that: example.com/calculate.php?hardware=Bitmain+AntMiner+S9%7C1-btc-sha-256%7C13000%7C1375

and I want it to be example.com/calculate.php?hardware=Bitmain+AntMiner+S9

How can I hide this last 3 parameters in JS or PHP?

Upvotes: 0

Views: 150

Answers (2)

Venkatesh Shanmugham
Venkatesh Shanmugham

Reputation: 81

There is no possible way to do it from client side and to hide the query parameters like 1hidden and 1 showing. But you can completely avoid sending values in query parameter by using "POST" method.

Upvotes: 0

Quentin
Quentin

Reputation: 943510

If you don't want them to be submitted, don't put them in the form in the first place.

<option value="Bitmain AntMiner S9">

Upvotes: 1

Related Questions