Array away?

Results 1 to 3 of 3

Thread: Array away?

  1. #1
    DaveZ Guest

    Default Array away?

    It&#039s a shopping cart ok, I have a dynamic form, created from a recordset which passes two values (a checkbox=productID, and a select=quantity with the same name)for each record. This gives me a comma delimited string to use for my dB insert. The values are in the correct order<BR><BR><BR>First, I "split" the string to get a one dimensional array, so I can work the data but what I need is a two dimensional array to insert the data into the proper fields.<BR><BR>I need remove any null items such as selects not chosen, and I get my string with all the data properly formatted. <BR><BR>myarray = split(request("ProdOrder"), ",")<BR><BR>for i = 0 to ubound(myarray)<BR>if isNull(i) then<BR>remove(i)<BR>end if<BR>next<BR><BR>This is where I lose it...<BR><BR>Can I make this a multi-directional array or did I forget to make a left turn in Albuquerque? I realize I can get a shopping cart somewhere but what do you learn by that?<BR><BR>Please help and advance thanx gigs<BR>Dave<BR>

  2. #2
    SPG Guest

    Default RE: Array away?

    Hrm, would it be possible to separate your items in the cart with something else (say, a ;)? I&#039m thinking along the lines of...<BR><BR>myCart = split(cart, ";")<BR>for each toy in myCart<BR> toy = split(toy, ",")<BR>next<BR><BR>(though you may need a i = 0 to ubound(myCart) instead of a for each).<BR><BR>Learn and grow wise!<BR>

  3. #3
    DaveZ Guest

    Default Close, but creating another problem

    to get the alternating delimiter, I placed a (;)in the select value of the form. This works, but places an extra comma in the string. also, I can&#039t seem to delete the null items in the string<BR><BR>here is what I have:<BR>mycart = split(request("ProdOrder"), ";")<BR>for i = 0 to ubound(mycart)<BR>toy = split(i, ",")<BR> for x = 0 to ubound(toy)<BR> If Isnull(x) then<BR> remove(x)<BR> end If<BR> next<BR>next<BR> ...a lot like what I had before except with the additions you provided. This is what I get from a response.write:<BR><BR>1, 3<BR>, , 3, 2<BR><BR>this is the result of a form with three records, two form fields each, the first and third are selected. The second field is empty, and that&#039s the one I need to remove, can&#039t seem to accomplish that.<BR><BR>

Posting Permissions

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