help with sessions and arrays?

Results 1 to 3 of 3

Thread: help with sessions and arrays?

  1. #1
    Don Jones Guest

    Default help with sessions and arrays?

    After receiving search results I want to pass one to a new page with a querystring. Then go back to the results page and choose another item to pass to the page mentioned previously. I can do this, the catch is that they overwrite each other.<BR><BR>I have tried using arrays and session variables, even tried dictionary object. I know it is easy and done often, but I just can&#039t figure it out.<BR><BR>Any help would be appreciated.<BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: help with sessions and arrays?

    So you kind of want a shopping cart, sort of, yeh?<BR><BR>Try storing the users selections in an array and then storing that array in a Session Variable.<BR><BR>So the user clicks on an item they want to add to the list say. This sends the user to the asp page you mentioned with the users selection as part of the url :<BR><BR><BR><BR>Mypage.asp get the item number. It then get the users item array from a Session varible that we set up in the global.asa file. It then adds the item to the next empty slot in the array and stores the array back in the Session varible and then displays the results.<BR><BR>&#060;%<BR>Dim MyItem<BR>Dim MyArray<BR>Dim Xtra &#039My work horse varible ;)<BR><BR>MyArray = Session("MyArray")<BR>MyItem = Response.QueryForm("Item")<BR><BR>For Xtra = LBound(MyArray) to UBound(MyArray)<BR>&#039When we set up the array in the global.asa file we<BR>&#039filled it will -1&#039s so if we find one we know that<BR>&#039that position in the array is empty<BR> If MyArray(Xtra) = -1 <BR> MyArray(Xtra) = MyItem<BR> Exit For<BR> End If<BR>Next<BR><BR>Session(MyArray) = MyArray<BR><BR>&#039Display list<BR>...<BR>%&#062;<BR><BR>Well something like that any way ;)<BR><BR>Hope that helps<BR><BR>Pete

  3. #3
    Jeff W. Bair Guest

    Default RE: help with sessions and arrays?

    Why would I be getting a type mismatch error on this line<BR>Dim MyArray<BR>MyArray = session("CartArray")<BR><BR>x = UBound(MyArray) &#039 this is the error<BR><BR>In the global.asa file session("CartArray") is set up as an array???

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts