Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Form adn db post question

Status
Not open for further replies.

wbodger

Programmer
Apr 23, 2007
769
US
So, I have this form where people enter the contact info for a group and then all of the group information following for up to 15 people. I write this info to 2 databases, once for the contact info and then then another with the individual peeps. Now, I don't know why I'm having such trouble with this, but how do I cycle thru the form data until I run into an empty set of data to post to the db? For instance, in the second post (using the id from the first post as a reference field), let's say I have Name, Gender, Age and Grade, so coming from the form I have:

Name1, Gender1, Age1, Grade1
Name2, Gender2, Age2, Grade2
etc.
up to
Name15, Gender15, Age15, Grade15

Now, perhaps only thru Grade10 has data in it. How do I:
1)Cycle thru the form data and
2) Stop when I hit an empty set of data?

I know this isn't difficult, but my brain just isn't working right now, so any help you can give me would be greatly appreciated.

Thanks,
Willie
 
You can getElementsByTagName or getElementsByID and check the value.
 
O, but those are javascript functions, are they not? I already have a lot of VBScript on the page and I can't intersperse javascript and VBScript commands that I am aware of. Actually, they would have to be embedded to work. Am I missing something here?

Willie
 
Yeah, after I sent that last post I found that it was a vbscript method, sorry. However, it is causing me issues and since I have not used it before, here goes another question. The form is on page 1 and the processing is on page 2 and I can't figure out what object in the DOM to use to call any of the getElements methods. Would it be best to just have the processing take place on the same page as the form?

Thanks again for the help,
Willie
 
With search and keyword getElementsByTagName, I quickly found:
thread329-1425984
 
OK, after playing around with this for a while, it does not appear to quite fill my needs, so I came up with another option that works most of the way, but there is a crucial step that I have not been able to solve as of yet, so here is the situation again.

I have a form with 11 fields at the top that define the overall group information. I first write this to a table and return the groupid.

Now, the second part of the form is 5 fields that repeat themselves incrementing the number designator as it goes (i.e. name1, email1, gender1, age1, gradecomp1, name2, email2, gender2, age2, gradecomp2 etc.) and what I want to do is step thru each set of five and post them to another table in the database. So, I would post name1, email1, gender1, age1, gradecomp1 to name, email, gender, age, gradecomp and then iterate thru again for name2, email2, gender2, age2, gradecomp2 posting to the same name, email, gender, age, gradecomp.

Any brilliant ideas on how to accomplish this splitting of the form data programmatically? I know I could hardcode each set, but that just doesn't work for me.

Thanks again for your help,
Willie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top