Results 1 to 3 of 3

Thread: Array

  1. #1
    Duc Guest

    Default Array

    I have a 2 dimensional array from a client side sub routine. Is there anyways I can submit this array when I submit the form.<BR>thank,<BR>Duc

  2. #2
    Join Date
    Dec 1969

    Default RE: Array

    Wow. Yes and no.<BR><BR>Perhaps the best way is to convert it to a single long string and store it in a hidden form field. Then, in the ASP page, you "decode" the string and make it into a 2D array again.<BR><BR>Suppose you had the 2D array:<BR><BR>1 Bill 1967<BR>8 John 1982<BR><BR>You could encode that as<BR><BR>1#Bill#1967$$8#John#1982<BR><BR>Then your ASP code could do:<BR><BR>&#060;%<BR>str = Request.Form("theHiddenField")<BR>rows = Split( str, "$$" ) &#039 split it into rows<BR>cols = Split( rows(0), "#" ) &#039 get columns for first row<BR><BR>rowcnt = UBound(rows)<BR>colcnt = UBound(cols)<BR><BR>Dim ar( )<BR>ReDim ar( rowcnt, colcnt )<BR>For row = 0 To rowcnt<BR> &nbsp; cols = rows( row )<BR> &nbsp; For col = 0 To colcnt<BR> &nbsp; &nbsp; ar( row, col ) = cols( col )<BR> &nbsp; Next<BR>Next<BR>%&#062;<BR><BR>Hokay? There are other ways, but this may be simplest.<BR><BR>

  3. #3
    Duc Guest

    Default Question

    Yes, I think your way would work. However what I have to do is I have a form let say first name and last name. I have to some how allow my user to enter data into the form. Also they want to be able to queue multiple record before submit it to the next page to then get all that information write it into a text.txt file. <BR><BR>I have thought to used session variable then keep concatinating the string then when I submit the information I can parse the string to get the right information. However I don&#039t know if this is the right ways to do it or not.

Posting Permissions

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