Skip to content Skip to sidebar Skip to footer

How To Hide Get Parameter From Url

It is possible to hide get value from url (rozgaarexpress.com/profile.php?id=22) using .Htaccess.I want to hide ?id=22. Then URL Looks like rozgaarexpress.com/profile.php My f

Solution 1:

You can't hide the ID parameter, even if you use .htaccess to achieve that. I mean you can do it but you will be able to use a single ID when accessing profile.php page which I don't think is the case you want.

You can do it by using sessions like:

demo.php

session_start();

$_SESSION['id'] = 22;

echo'<a href="profile.php">My profile</a>';

profile.php

session_start();

echo $_SESSION['id'];

Solution 2:

im sure you asked this question to find a way to avoiding show ID to public.

you can use session in this case like this:

<?php
  session_start();
  $_SESSION['session_name']=$id; // Set the value of the id you want to pass.?>

and in profile.php page you need this:

<?php
 session_start();
 $id = $_SESSION['session_name'];
 ?>

or you can use JQuery.post to pass your data.

Solution 3:

I would rather take the desired profile ID from the Client. This allows the end-user the option to open two different profiles from the same page:

<scripttype="text/javascript">functionsetInputAndSubmit(input) {
  var form=document.getElementById("skfrom");
  var inputEl=document.getElementById("LANG");
  inputEl.value = input;
  form.submit();
} </script><formid="skfrom"name="myform"action="http://rozgaarexpress.com/profile.php"method="POST"><divalign="center"><ahref="javascript:;"onclick="setInputAndSubmit(34);">First ID</a><br><ahref="javascript:;"onclick="setInputAndSubmit(22);">Another ID</a><br><br><ahref="javascript:;"onclick="setInputAndSubmit(22);">Same ID</a><br><br>
    You can even receive input from users and send it together with the ID.
    <inputtype="text"size="25"value="Some other field you want visible"><inputtype="hidden"id="LANG"name="Language"value="English"></div></form>

Post a Comment for "How To Hide Get Parameter From Url"