Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Question for intermediate or advanced users?


Recommended Posts

I am integrating a few different things into OS 2.2.


What I am doing is creating a few extra pages. I have managed to work out how to drive the pages by database finally.


The problem I have at the moment is passing and handling a value from one page to the next.


What is the easiest and best way to do this.


For example: I have a tracking_id that is a handle to a particular item that I need to track for the users session. I create the tracking_id on page 1 and then need to use it on page 2 and 3.


Do I need to use a GLOBAL variable or session build.


What do you recommend and would really appreciate being pointed in the right direction?

Link to comment
Share on other sites

Well, probably the easiest way is to put it in the query string. If it's not sensitive information, this is probably whatI would do.


You could put it in the cookie, but that'll only work if customs are accepting cookies. If you force cookie usage, that might be a good idea.


You could write it to a DB table. Just insert the customer_id and the value you want into it on the first page, and then query from it when you need the data. This would be good if storing the data would be useful.


You could write it to a temporary file, and then read it back in when you needed it. This is a down and dirty type of method.


You could also use a combination of out_buffer and redirection to get the value to the pages you need.


And, you can also use a global variable.


Personally, I'd use one of the first two methods, unless the data you need has any historical significance. In that case I would use the third.


NOTE: As of Oct 2006, I'm not as active in this forum as I used to be, but I still work with osC quite a bit.

If you have a question about any of my posts here, your best bet is to contact me though either Email or PM in my profile, and I'll be happy to help.

Link to comment
Share on other sites

Yes the information is of a sensitive nature. The information I am grabbing is held in a separate table but the customer can have multiple tracking_id's so that is why I need to be able to hold the tracking_id value for multiple pages.


I think I will have to use a global variable which is against my religion but I will do so. They can get messy and hard to debug errors.


My limited background of programming is in C and Visual C++ but picking up php pretty well.


I am getting a bit lost where the global variables are first created and initialised especially customer_id. Is there 2 types of global variables with different scope. There almost seems like a 'super' global variables.


I am a bit confused. I guess I will get there though. Hoping for some shortcut. I have searched the forum but cant seem to see much on this sort of topic. If anyone does have hints or knows of another related thread greatly appreciate the info.



Link to comment
Share on other sites


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

  • Create New...