Comdemned Posted May 14, 2008 Share Posted May 14, 2008 Hi all, I would like to know how to pass data between pages within the same site without using the address bar. At the moment I have very long URL's. Currently I am using the index.php?option=option&client_id=client_id&this=this&that=that etc. Then on the other page Im using the %_GET['option'] method. I want to be able to just use index.php (or index.php?option=option) and have the rest of the data sent in the background with out the information being displayed in the address bar. Thanks Murray Quote Link to comment Share on other sites More sharing options...
peranha Posted May 14, 2008 Share Posted May 14, 2008 Sessions will work $_SESSION['option'] = "something"; $_SESSION['clientid'] = "clientid"; $_SESSION['this'] = "this"; an on the page you want to call it just put $_SESSION['option']; as in echo $_SESSION['option']; Quote Link to comment Share on other sites More sharing options...
haku Posted May 14, 2008 Share Posted May 14, 2008 You have to make sure you turn on sessions on both pages when using the above method. Put session_start(); At the top of both pages. Quote Link to comment Share on other sites More sharing options...
peranha Posted May 14, 2008 Share Posted May 14, 2008 Yes, as stated, session_start(); has to be at the top of all pages where this will be used. Sorry, forgot to mention that. Quote Link to comment Share on other sites More sharing options...
Comdemned Posted May 17, 2008 Author Share Posted May 17, 2008 Hi, I already use sessions for the current logged in user. I would like to avoid using sessions for this if possible. Is there any way to do this without using sessions? Thanks Murray Quote Link to comment Share on other sites More sharing options...
phpzone Posted May 17, 2008 Share Posted May 17, 2008 What are you trying to hide? The quesy string is meant for passing parameters. Solutions depend on what your trying to achieve here, for instance, if you don't like ?§ion=news&seq=6 Then you should look into URL re-writing, you can use the PATH_INFO server variable for url shortening. Quote Link to comment 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.