NathanBrisk Posted September 12, 2008 Share Posted September 12, 2008 For my client I need to have a variable transparently passed from one php page to another. I don't want to use sessions/cookies because I don't want someone to be able to open a new tab and have the session variable persist into the other tab. This variable can be set in PHP and I'd like for it to be passed via POST (if this is possible). Is this possible? Quote Link to comment https://forums.phpfreaks.com/topic/123951-solved-persistent-variables-without-the-use-of-sessions-or-cookies/ Share on other sites More sharing options...
KevinM1 Posted September 12, 2008 Share Posted September 12, 2008 For my client I need to have a variable transparently passed from one php page to another. I don't want to use sessions/cookies because I don't want someone to be able to open a new tab and have the session variable persist into the other tab. This variable can be set in PHP and I'd like for it to be passed via POST (if this is possible). Is this possible? It's possible by using hidden form inputs: Page 1 - <form action="page2.php" method="post"> <input type="hidden" name="hidden" value="something" /> </form> Page 2 - <?php $hidden = $_POST['hidden']; . . . ?> <form action="page3.php" method="post"> <input type="hidden" name="hidden2" value="<?php echo $hidden; ?>" /> </form> Page 3 - <?php $hidden2 = $_POST['hidden2']; . . . ?> And so on. Keep in mind, this isn't a secure way to transfer data. Hidden inputs aren't displayed on the screen, but still show up in the source code of the document. So, don't use it for anything sensitive. Quote Link to comment https://forums.phpfreaks.com/topic/123951-solved-persistent-variables-without-the-use-of-sessions-or-cookies/#findComment-639851 Share on other sites More sharing options...
NathanBrisk Posted September 12, 2008 Author Share Posted September 12, 2008 Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/123951-solved-persistent-variables-without-the-use-of-sessions-or-cookies/#findComment-639900 Share on other sites More sharing options...
BlueSkyIS Posted September 12, 2008 Share Posted September 12, 2008 !!don't use it for anything sensitive!! Quote Link to comment https://forums.phpfreaks.com/topic/123951-solved-persistent-variables-without-the-use-of-sessions-or-cookies/#findComment-639902 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.