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:
<script type="text/javascript">
function setInputAndSubmit(input) {
var form=document.getElementById("skfrom");
var inputEl=document.getElementById("LANG");
inputEl.value = input;
form.submit();
} </script>
<form id="skfrom" name="myform" action="http://rozgaarexpress.com/profile.php" method="POST">
<div align="center">
<a href="javascript:;" onclick="setInputAndSubmit(34);">First ID</a>
<br>
<a href="javascript:;" onclick="setInputAndSubmit(22);">Another ID</a>
<br><br>
<a href="javascript:;" onclick="setInputAndSubmit(22);">Same ID</a>
<br><br>
You can even receive input from users and send it together with the ID.
<input type="text" size="25" value="Some other field you want visible">
<input type="hidden" id="LANG" name="Language" value="English">
</div>
</form>
Post a Comment for "How To Hide GET Parameter From URL"