Results 1 to 2 of 2

Thread: Session Arrays

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2002
    Posts
    42

    Session Arrays

    I am trying to reference an array from multiple pages during a session. I guess the first question is if this is possible If it is, here is the situation:

    On the first instance of the page, I am selecting 20 numbers from an database and storing them in an array. Then the corresponding question of array[1] is selected and dispalyed. Once the user answers this question, I am reloading the same page, but skipping the script that populates the array. However, I still want to be able to reference the next location of the array that was populated when the page was originally loaded. Is this possible and if so, how.

    Thanks everyone...

  2. #2
    Frenzied Member
    Join Date
    Feb 2001
    Posts
    1,140
    A quick and dirty test that should answer your question.

    Code:
    <% @Language="VBScript" %>
    <%
      Option Explicit
    %>
    <html>
      <head>
        <title>Test ASP</title>
      </head>
      <body>
        <%
          If Session("CallCount") = "" Then
            Session("CallCount") = 1
    
            Dim Foo(2)
    
            Foo(0) = "Bar"
            Foo(1) = "Blah"
    
            Session("myFoo") = Foo
    
            Response.Write "<p>Reload</p>"
          Else
            Dim myFoo
            myFoo = Session("myFoo")
            Response.Write "<p>" & myFoo(0) & "</p>"
          End If
        %>
      </body>
    </html>
    Travis, Kung Foo Journeyman
    As always, RTFM.

    WWW Standards: HTML 4.01, CSS Level 2, ECMA 262 Bindings to DOM Level 1, JavaScript 1.3 Guide and Reference
    Perl: Learn Perl, Llama, Camel, Cookbook, Perl Monks, Perl Mongers, O'Reilly's Perl.com, ActiveState, CPAN, TPJ, and use Perl;
    YBMS, but Mozilla doesn't.

Posting Permissions

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



Click Here to Expand Forum to Full Width