Querystring and arrays??

Results 1 to 2 of 2

Thread: Querystring and arrays??

  1. #1
    Join Date
    Dec 1969

    Default Querystring and arrays??

    Greetings,<BR><BR>I have a querystring we&#039ll call strState. Of course there are 50 possible values. The state names are abbreviated, but I would like the entire state name displayed in the title of the returned form. Do I need to set up 50 IF statements for each of these states, i.e. if strState="TX" then response.write Texas, or can I do an array? I&#039m not that familiar with arrays, so if someone could get me started, if this is the way to go, I would greatly appreciate it. Thanks.<BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: Querystring and arrays??

    What you really want is a dictionary - it allows you to associate a key (your abreviation, in this case) with a value (the full name). The only downside of a dictionary is that you can&#039t store it at application or session scope (where it would be really handy in this case) because of threading problems. Define it in a subroutine and put that in an include file so that you can use it wherever you need it.<BR><BR>Basically use it like this:<BR><BR>Dim objDict<BR>Set objDict = Server.CreateObject("Scripting.Dictionary")<BR>obj Dict.Add "TX", "Texas"<BR>.....<BR><BR>Respone.Write(objDict(strS tate)) &#039objDict("TX") returns "Texas"<BR><BR>Of course the other option is to stick the data in a DB table and do a lookup through that...<BR><BR>HTH<BR><BR>Dunc

Posting Permissions

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