By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
438,162 Members | 1,061 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 438,162 IT Pros & Developers. It's quick & easy.

shopping cart problem

100+
P: 347
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

Expand|Select|Wrap|Line Numbers
  1. <%
  2.  
  3. if InStr(session("recordsInCart"), ","&request.form("recordNum")) = 0 then 
  4.    session("recordsInCart") = session("recordsInCart") + request.form("recordNum") &","
  5. else 
  6.    'do nothing
  7. end if 
  8. %>
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
File Type: zip viewshortlist.zip (34.1 KB, 49 views)
Sep 19 '12 #1
Share this Question
Share on Google+
1 Reply


Expert 100+
P: 164
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.
Oct 27 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.