php - Hide id from url -
i want pass id 1 page when user clicks url. there can multiple url each corresponding separate id. based on url clicked, want pass corresponding id , action. using following approach:
<a href="process.php?action=del&id='.$id.'">
however both action , id visible in url. there way hide information in url , not passing through url? if pass them using hidden fields, can accessed using browser dev tools. want make them secure can't read or modified @ all. hide security purpose no user can see this
in html only, you'll not able pass "hidden" variables through $_get
.
if want hide variables when user click on link, can use javascript auto-submitted form use $_post
variables.
example
<form method="post" action="yourpage.php" id="yourform" style="display:none;"> <input type="hidden" name="hiddenfield" value="__" /> </form> <a href="" onclick="document.getelementbyid('yourform').submit();return false;" />
now, in yourpage.php
, you'll able obtain $_post['hiddenfield']
value.
edit:
i don't think can possible hide values dev tools. btw, can maybe use sessions, more "secure"..
example:
// page1.php session_start(); $_session['yourname'] = 'yourvalue'; // page2.php session_start(); $_session['yourname']; // contains 'yourvalue'
Comments
Post a Comment