shopping cart problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • colinod
    Contributor
    • Nov 2007
    • 347

    shopping cart problem

    i have a shopping cart type of thing using session variables on my site, all has been working fine until today when someone copied the link of the page that views the cart and emailed it to us, i then realised that this will not work as the session variable is not in the page address, is there any way of adding a session variable to a page link aswell as sending it throught the variables?

    i use thsi code on pages to add to session variable

    Code:
    <%
    
    if InStr(session("recordsInCart"), ","&request.form("recordNum")) = 0 then 
       session("recordsInCart") = session("recordsInCart") + request.form("recordNum") &","
    else 
       'do nothing
    end if 
    %>
    i was wondering if i changed it so that i sent the session variable from the page in the link and then somehow used that link information to then make it a nes session variable on a new page?

    i have attached some pages too
    Attached Files
  • Nicodemas
    Recognized Expert New Member
    • Nov 2007
    • 164

    #2
    Session variables themselves cannot be passed along; however, the data they store can be arbitrarily passed on. Two alternate ways to accomplish what you are trying to do is to:

    (1) Save the list of cart items to a database table with a unique ID. The link to view the cart could then contain a querystring variable to passes the unique ID to a script which can query the database table for its relevant items;

    or (2) all items are stored in querystring variables in the link.

    Comment

    Working...