ainoy31 Posted June 28, 2007 Share Posted June 28, 2007 I am passing a variable from one page via the URL and requesting it on another page -> $_REQUEST['id1']; I need to gave this data and then pass it to another page. Do I use the same method or can I assign the request data to a new variable? Hope this is not confusing. Much appreciation. AM Link to comment https://forums.phpfreaks.com/topic/57603-passing-variable-via-url/ Share on other sites More sharing options...
cooldude832 Posted June 28, 2007 Share Posted June 28, 2007 slightly, but try passing it using a session are you saying you have: http://www.mypage.com/mypage.php?id2=$var ? and you want to have it then go to: http://www.mypage.com/mypage2.php_id2=$var2 ? Link to comment https://forums.phpfreaks.com/topic/57603-passing-variable-via-url/#findComment-285097 Share on other sites More sharing options...
chocopi Posted June 28, 2007 Share Posted June 28, 2007 you could use $_GET instead of $_REQUEST but thats not too important You should use sessions but the basic idea is you start with session_start(); and then store sessions like this: <?php session_start(); $_SESSION['id'] = $_RQUEST['id1']; ?> Then on whatever page you use session_start(); you will be able to call the id. Thats a helf-arsed explanation, but i think it covers the general idea ~ Chocopi Link to comment https://forums.phpfreaks.com/topic/57603-passing-variable-via-url/#findComment-285100 Share on other sites More sharing options...
ainoy31 Posted June 28, 2007 Author Share Posted June 28, 2007 I have say xxx.php?id=$amount on one page. I am requesting that variable on another page by using <? echo $_REQUEST['id'] ?>. Which works fine. Now, I want to use the same variable onto a third page. Assigning the request variable to a new variable does not work. Link to comment https://forums.phpfreaks.com/topic/57603-passing-variable-via-url/#findComment-285126 Share on other sites More sharing options...
cooldude832 Posted June 28, 2007 Share Posted June 28, 2007 well it doesn't store $_GET vars($_REQUEST is a generalized call for GET, POST, SESSION) You would need to either store it into a $_SESSION or replace it in the url again Link to comment https://forums.phpfreaks.com/topic/57603-passing-variable-via-url/#findComment-285131 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.