Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Creating new varaible using tep_session function


camNZ

Recommended Posts

Hello,

 

I would like to utlise the tep_session function and basically create a new variable which I can access from each page.

 

Normally I would create this by doing the following:

 

$_SESSION["myVar"] = "Hello";

 

How would I create a new session variable using the tep_session function and then how would I retrieve it again?

 

Many thanks,

Campbell

Link to comment
Share on other sites

How would I create a new session variable using the tep_session function and then how would I retrieve it again?
See how that is done in login.php. $_SESSION['myVar'] will do the job of retrieving it (if set of course). To see if it is registered there is a function called tep_session_is_registered.
Link to comment
Share on other sites

Hi,

 

Sorry, I didnt quite understand that.

 

Are you saying I can create a new session variable called "myVar" by doing the following:

 

tep_session_register('myVar');

 

Then assign a value to it:

 

$myVar = 100;

 

Then to retrive it i would do this:

 

$myVarValue = tep_session_register('myVar');

 

Thanks,

Campbell

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...