Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PHP Sessions how to store a variable


CdRSkULL

Recommended Posts

Posted

Hi all.. been playing for the last couple of days and also doing lots of googling.. but still cant seem to figure out how to store a variable in a php session.

 

I only want to store one variable.. Now from what I've read you need application-top required which I have.. then I add something like.

 

$_SESSION['notes'] = "TESTING";

 

I am then trying to recall this variable from another page..

 

<?PHP $_SESSION['notes']; ?

 

Now I've tried using the session start but cant seem to get anything working.. I did read about tep_session_register or something.. but on searching for that revealed not much basic help.

 

could someone please just do a very basic example of what I need to code in to write and also read a variable back..

 

tvm..

 

Steve

Posted

  if ( ! tep_session_is_registered('notes') ) {
$notes = "TESTING";
tep_session_register('notes');
 }

The other page you use the var on has to use /includes/application_top.php to inherit the osC session (and all the var's)

 

Refer to the var as $notes on the other page.

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Posted
  if ( ! tep_session_is_registered('notes') ) {
$notes = "TESTING";
tep_session_register('notes');
 }

The other page you use the var on has to use /includes/application_top.php to inherit the osC session (and all the var's)

 

Refer to the var as $notes on the other page.

 

thank you very much :-) all makes sense now.

 

Steve

Archived

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

×
×
  • Create New...