Jump to content

how do i call this?


djcritch

Recommended Posts

Hi i have set up a php session using GET but having a bit of trouble calling the information, can anyone see what im doing wrong?

 

heres what ive got:

 

session_start();
foreach ($_GET as $key => $value)
{
  $_SESSION[$key] = $value;
}

 

and to call it i have:

 

<?php $_SESSION['url'] echo $_value; ?>

 

but im guessing this is incorrect ?

Link to comment
https://forums.phpfreaks.com/topic/97048-how-do-i-call-this/
Share on other sites

im guessing when you run that FOREACH loop, 'URL' is what is being passed over as the name of the session.

 

You then store the Data in the session.

 

So I think you would need: -

 

 <?php echo $_SESSION['url']; ?>

 

Im not too sure what your trying to acheive with the code though so I'm not sure this is what you want. Also, if the $_GET fails, then there is no data to be stored in the session, so there would be no data to output.

 

Link to comment
https://forums.phpfreaks.com/topic/97048-how-do-i-call-this/#findComment-496622
Share on other sites

depending on your installation you need a "session_start()" at the top of each script using sessions.

 

also depending on your installation you may need to pass a query string between pages that use sessions eg:

 

www.url.com/index.php?PHPSESSID=3ui92grubf23yfgw34r

 

the phpsessid is recognized by session_start(),

Link to comment
https://forums.phpfreaks.com/topic/97048-how-do-i-call-this/#findComment-496649
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.