This is a discussion on "Array Multiple records" within the Classic ASP section. This forum, and the thread "Array Multiple records are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
Array Multiple records
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
#1
|
|||
|
|||
|
Hello-
I have a form where I have mutiple lines of the same thing. Users will input a type of equipment the ID# and other minute data. Instead of creating a table and column for every line, I would like to create a new row for each line the user inputs. However, i am not sure how i can force the array to know which line goes with what data? You can see an example here: http://www.ecinsurance.com/test/equipment.htm any help would be appreciated. I have the following code for simple array inputs. Changes and suggestions to make what i need work would be helpful if Request.Form <> "" then CNumber = CNumber office_name= Request.form("office_name") Office_ID = Request.form("Office_ID") Office_purchase = Request.form("Office_purchase") Office_date = Request.form("Office_date") Office_cost = Request.form("Office_cost") Office_condition = Request.form("Office_condition") MyList = Request.Form("ListID") myArray = split(MyList,",") For i = 0 to uBound(myArray) strSQL = strSQL & "INSERT INTO MyTable (Cnumber, Office_Name, Office_ID, Office_Purchase, Office_Date, Office_Cost, Office_Condition) VALUES (" & CNumber & "," & myArray(i) & ");" NEXT GetFromDatabase strSQL Response.Redirect"newpage.asp" end if |
|
|
|
#2
|
|||
|
|||
|
Re: Array Multiple records
I couldn't find anything that guarenteed that office_date(i) would necessarily correlate to Office_cost(i) when I did something like this. Not to say that it isn't true, but I never found documentation one way or another.
So I created form fields office_date0, office_Date1.... and a hidden field called count Then on the processing end I looped the form from 0 to count-1 inserting request.form("office_[variable]" & i) It's clunky, but totally reliable and reasonably readable. Let me know if you'ld like to see code. |
|
#3
|
|||
|
|||
|
Re: Array Multiple records
Thank you for the response. It shows you know exactly what i am talking about. Some code would be helpful! Thanks again!
|
|
#4
|
|||
|
|||
|
Re: Array Multiple records
Well this was for books, but I think you'll get the idea...
on the html page:
(getArrayData is just a funciton to store all of the form in one array so you don't have to know where it comes from because in this application I didn't...) I also use join(array(list), "[]") a lot to join a series of things instead of item1 & "[]" & item2.... It's cleaner to read. Let me know if anything else isn't clear... HTH |
|
#5
|
|||
|
|||
|
This worked great! Thanks for the code and the help!
James F. |
|
#6
|
|||
|
|||
|
Would you be available for some freelance work? I would need some of that work in the next 2 days if possible.
Thanks James F. |
|
#7
|
|||
|
|||
|
Re: Array Multiple records
I might be interested, but not in the next 2 days. I've got commitments for the next 3 evenings.
Thanks for the offer. |
![]() |
| Tags |
| array, multiple, records |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Select records based on multiple conditions - need help | Love2Java | Databases | 9 | Oct 29th, 2007 14:37 |
| Validatwe multiple checkbox with array [] | Mochachino | JavaScript Forum | 0 | May 5th, 2007 04:44 |
| Updating multiple records at the same time prob. with script | at51178 | Classic ASP | 11 | Feb 1st, 2006 17:56 |
| array unable to check another array so as to be displayed | Ozeona | Flash & Multimedia Forum | 1 | Aug 5th, 2005 10:26 |
| Appending multiple records | jakyra | Classic ASP | 0 | Sep 8th, 2003 19:33 |