dynamic form fields and processing

B

Bill

I have a page that has form fields and their names are generated dynamically
based on the user ids. What this page does is search for all members that are
currently on a specific team and generate form entry fields for that person
and it cycles through all members and I end up with form fields named as
such form_kills1, form_kills2. So the names are the same only Member ids are
appended to the ends. Now here is how I am trying to process them on the
script page.

Code:
rsMembers = dbConn.Execute("Select * from tblmembers Where TeamID='" &
strteamid&"'")
While NOT rsMembers.eof
MemberID = rsMembers("MemberID")
IF Request.form(MemberID) = "checked" Then
strplayer = MemberID
strkills = Request.Form("form_kills" + strplayer)
strdeaths = Request.Form("form_deaths" + strplayer)
strchickens = Request.Form("form_chickens" + strplayer)
strflags = Request.Form("form_flags" + strplayer)
set rsUpdateMatches = dbConn.Execute("Insert INTO tblmatches
(MemberID,MatchNum,Kills,Deaths,Chickens,Flags) values ("& MemberID &",
"&strmatchnum&", "&strkills&", "&strdeaths&", "&strchickens&", "&strflags&")")
ELSE
END IF
rsMembers.movenext
WEND

my page is just getting timed out right now and im not sure why? but is this
the proper way to handle such a task? Thanks for the help
 
S

Stefan B Rusynko

Add some debugging code to see where your code stalls

Say:

After each variable like:
MemberID = rsMembers("MemberID")
Add a line
Response.write MemberID & "<br>" ' Debug only

If it stalls before that line your problem is w/ your rsMembers = line

And then check for missing values just before "set rsUpdateMatches"
Add a line
Response.write "Insert INTO tblmatches (MemberID,MatchNum,Kills,Deaths,Chickens,Flags) values ("& MemberID &", "& strmatchnum & ",
" & strkills & ", " & strdeaths &", "& strchickens & ", " & strflags & ")"

PS
Is TeamID in your Table also a string?
rsMembers = dbConn.Execute("Select * from tblmembers Where TeamID=' " & strteamid & " ' ")

--

_____________________________________________
SBR @ ENJOY (-: [ Microsoft MVP - FrontPage ]
"Warning - Using the F1 Key will not break anything!" (-;
To find the best Newsgroup for FrontPage support see:
http://www.frontpagemvps.com/FrontPageNewsGroups/tabid/53/Default.aspx
_____________________________________________


|I have a page that has form fields and their names are generated dynamically
| based on the user ids. What this page does is search for all members that are
| currently on a specific team and generate form entry fields for that person
| and it cycles through all members and I end up with form fields named as
| such form_kills1, form_kills2. So the names are the same only Member ids are
| appended to the ends. Now here is how I am trying to process them on the
| script page.
|
|
Code:
| rsMembers = dbConn.Execute("Select * from tblmembers Where TeamID='" &
| strteamid&"'")
| While NOT rsMembers.eof
| MemberID = rsMembers("MemberID")
| IF Request.form(MemberID) = "checked" Then
| strplayer = MemberID
| strkills = Request.Form("form_kills" + strplayer)
| strdeaths = Request.Form("form_deaths" + strplayer)
| strchickens = Request.Form("form_chickens" + strplayer)
| strflags = Request.Form("form_flags" + strplayer)
| set rsUpdateMatches = dbConn.Execute("Insert INTO tblmatches
| (MemberID,MatchNum,Kills,Deaths,Chickens,Flags) values ("& MemberID &",
| "&strmatchnum&", "&strkills&", "&strdeaths&", "&strchickens&", "&strflags&")")
| ELSE
| END IF
| rsMembers.movenext
| WEND
|
|
| my page is just getting timed out right now and im not sure why? but is this
| the proper way to handle such a task? Thanks for the help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top