i8grand Posted May 24, 2010 Share Posted May 24, 2010 Is there a way I can request a value from a previous page on a website with having to post it. I have created a value $puzzle on a page on my website and am looking to use it on the next page when a user clicks a link to that page! Is it just a matter of using REQUEST[$puzzle]? I am relatively new to PHP and any help at all would be brilliant, thanks. Dylan Link to comment https://forums.phpfreaks.com/topic/202767-requesting-values/ Share on other sites More sharing options...
Bladescope Posted May 24, 2010 Share Posted May 24, 2010 A few methods. You could use $_GET, which retrieves values from URLS. E.g. http://fake.url.com/page.php?foo=bar&id=12 $_GET['foo'] would be 'bar' $_GET['id'] would be 'id' This would have to be set in the links to that page though for it to work. You could also use a SESSION or set a COOKIE. Related example: The previous page. session_start(); ... $_SESSION['puzzle'] = "foo"; ... And on the other page. session_start(); ... echo $_SESSION['puzzle']; ... Of course, you can do anything with the retrieved session. Same applies with cookies. Hope I've helped . Link to comment https://forums.phpfreaks.com/topic/202767-requesting-values/#findComment-1062723 Share on other sites More sharing options...
i8grand Posted May 24, 2010 Author Share Posted May 24, 2010 It sounds good to me, I haven't got the right files with me atm to try it out but I'll let you know if it does. Thanks very much Link to comment https://forums.phpfreaks.com/topic/202767-requesting-values/#findComment-1062730 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.