Ache Posted November 18, 2008 Share Posted November 18, 2008 I have a html form that sends a variable (UniqueID) to a php file. The php file starts with: // Get user number$prk = $_POST['prk'];include ("user-menu.php");include ("config.php"); Sofar everything is working. user-menu-php is a menu that I show on all pages the user has access to after login.What I want is somehow to remember the UniqueID so that when a user picks a option from the menu and a new page opens, I can use UniqueID on that page.I have tried with global variables and session but I can't get either to work. (globals is on on the server)Any idea on how I can do it? Link to comment Share on other sites More sharing options...
jeffman Posted November 18, 2008 Share Posted November 18, 2008 Keep learning about sessions. This is exactly that they exist for. Something like:login.php if (!empty($_POST['prk'])) { session_start(); $_SESSION['user'] = $_POST['prk'];}// etc. another.php session_start(); if (!empty($_SESSION['user'])) { // USER IS LOGGED IN}// etc. Link to comment Share on other sites More sharing options...
Ache Posted November 19, 2008 Author Share Posted November 19, 2008 Thank you very much. I got it working now. And yes, I keep learning. Only started to learn PHP very recently, And I am very surprised what I can do already (with a little help from people here). Looking at your example code I now know what I did wrong when I tried with a session. I did not start it in the "another.php". Ah well, another problem tackled and I learned something Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.