cherylinn Posted July 2, 2012 Share Posted July 2, 2012 Hi, i have a question on unique id. I am creating a page for user to register their account with a unique id given. When user has successfully created, the page will direct them to another page that display their unique id. How do i make sure the unique id in the successful page is the same as the unique id given in the page they are registering? For example, $name = uniqid(); echo "$name"; Quote Link to comment https://forums.phpfreaks.com/topic/265109-unique-id/ Share on other sites More sharing options...
ManiacDan Posted July 2, 2012 Share Posted July 2, 2012 Use the session Quote Link to comment https://forums.phpfreaks.com/topic/265109-unique-id/#findComment-1358552 Share on other sites More sharing options...
xyph Posted July 2, 2012 Share Posted July 2, 2012 Alternately, pass that ID along in the query string. header('Location: http://yourwebsite.com/nextPage.php?id='.$generatedId); And access it using $_GET['id'] on nextPage.php Quote Link to comment https://forums.phpfreaks.com/topic/265109-unique-id/#findComment-1358695 Share on other sites More sharing options...
ManiacDan Posted July 3, 2012 Share Posted July 3, 2012 xyph's solution is perfectly correct. However, I recommended the session because I figured you'd need the userID throughout your site for login and permission checking. May as well put it in the session now. Quote Link to comment https://forums.phpfreaks.com/topic/265109-unique-id/#findComment-1358790 Share on other sites More sharing options...
xyph Posted July 3, 2012 Share Posted July 3, 2012 It's more than likely homework, judging by previous posts. Quote Link to comment https://forums.phpfreaks.com/topic/265109-unique-id/#findComment-1358807 Share on other sites More sharing options...
Jessica Posted July 3, 2012 Share Posted July 3, 2012 It's more than likely homework, judging by previous posts. So do it right now, and we won't have to tell him to change it later for the next assignment Quote Link to comment https://forums.phpfreaks.com/topic/265109-unique-id/#findComment-1358843 Share on other sites More sharing options...
xyph Posted July 3, 2012 Share Posted July 3, 2012 It's more than likely homework, judging by previous posts. So do it right now, and we won't have to tell him to change it later for the next assignment And if the goal of the assignment was to learn how to pass variables through requests? Who knows, most intro IT teachers are pretty clueless. Quote Link to comment https://forums.phpfreaks.com/topic/265109-unique-id/#findComment-1358941 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.