By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,294 Members | 2,645 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,294 IT Pros & Developers. It's quick & easy.

ASP UPDate database looping through form fields

P: n/a
Hi,

I have a small online survey in two parts designed to allow users to
rank a few organisations that they have dealings with from a large
list of organisations. I want the users to be able to rank a number
of organisations at the same time rather than going through a form for
each one.

At the moment the survey has two pages. The first page allows the user
to select a number of organisations from the list. This selection is
saved in a table in an Access database with five fields: ID, User,
Organisation and Ranking.

The second page loops through the data from the database selected by
user and presents the list of organisations in a table with a row for
each record. The table has a ranking field for each organisation. The
user enters numeric data in this field to rank the organisation.

So far so good. Where I am having problems is in updating the database
with the data from the form. What I need to do is loop through each
line of the table on the form, select the record from the database,
update it and then move to the next item.

The form has a field for each record with the same name so using
Request.Form("FieldName") to grab the data from the form doesn't seem
to work.

I am sure that there must be a way of achieving what I want do: but I
can't get it.

I'd appreciate any suggestions or pointers.

Thanks in advance for any help.

Regards
Emmett Power
Jul 19 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
How about;

<%
strString1 = Request.form("Ima_Field")

Do Until rst.eof
rst("TheField")=strString1
rst.MoveNext
Loop
%>

--

Regards

Steven Burn
Ur I.T. Mate Group
www.it-mate.co.uk

Keeping it FREE!
"Emmett Power" <Em****@Silico-Research.com> wrote in message
news:6e**************************@posting.google.c om...
Hi,

I have a small online survey in two parts designed to allow users to
rank a few organisations that they have dealings with from a large
list of organisations. I want the users to be able to rank a number
of organisations at the same time rather than going through a form for
each one.

At the moment the survey has two pages. The first page allows the user
to select a number of organisations from the list. This selection is
saved in a table in an Access database with five fields: ID, User,
Organisation and Ranking.

The second page loops through the data from the database selected by
user and presents the list of organisations in a table with a row for
each record. The table has a ranking field for each organisation. The
user enters numeric data in this field to rank the organisation.

So far so good. Where I am having problems is in updating the database
with the data from the form. What I need to do is loop through each
line of the table on the form, select the record from the database,
update it and then move to the next item.

The form has a field for each record with the same name so using
Request.Form("FieldName") to grab the data from the form doesn't seem
to work.

I am sure that there must be a way of achieving what I want do: but I
can't get it.

I'd appreciate any suggestions or pointers.

Thanks in advance for any help.

Regards
Emmett Power

Jul 19 '05 #2

P: n/a
Hello Emmett
Try this!

<HTML>
<HEAD>
</HEAD>
<BODY><%
Dim Item
response.write "<TABLE cellSpacing=0 cellPadding=0 width=715 border=0>"
response.write "<Th align=center vAlign=top WIDTH=33% colSpan=3>Key</TD> "
response.write "<Th align=right vAlign=top WIDTH=33% colSpan=3>Item</TD> "
response.write "<Th align=right vAlign=top WIDTH=33% colSpan=3>Count</TD>
"
Response.Write "<tr><TD>"

For Each Item in Request.Form

response.write "<TD align=left vAlign=top WIDTH=33% colSpan=3> "
Response.Write Request.Form.Key(Item) & ": " & "</td><TD>"
response.write "<TD align=left vAlign=top WIDTH=33% colSpan=3> "
Response.Write Request.Form.Item(Item) & " " & "</td><TD>"
response.write "<TD align=left vAlign=top WIDTH=33% colSpan=3> "
Response.Write Request.Form.Item(Item).Count & "</td></tr><tr><TD>"
Next
Response.Write "</TABLE> "
%>
</BODY>

</HTML>

"Emmett Power" <Em****@Silico-Research.com> wrote in message
news:6e**************************@posting.google.c om...
Hi,

I have a small online survey in two parts designed to allow users to
rank a few organisations that they have dealings with from a large
list of organisations. I want the users to be able to rank a number
of organisations at the same time rather than going through a form for
each one.

At the moment the survey has two pages. The first page allows the user
to select a number of organisations from the list. This selection is
saved in a table in an Access database with five fields: ID, User,
Organisation and Ranking.

The second page loops through the data from the database selected by
user and presents the list of organisations in a table with a row for
each record. The table has a ranking field for each organisation. The
user enters numeric data in this field to rank the organisation.

So far so good. Where I am having problems is in updating the database
with the data from the form. What I need to do is loop through each
line of the table on the form, select the record from the database,
update it and then move to the next item.

The form has a field for each record with the same name so using
Request.Form("FieldName") to grab the data from the form doesn't seem
to work.

I am sure that there must be a way of achieving what I want do: but I
can't get it.

I'd appreciate any suggestions or pointers.

Thanks in advance for any help.

Regards
Emmett Power
Jul 19 '05 #3

P: n/a
Personally, i think the best solution is:
after the user selects that they want eg. 5 items
for each item you print out, give it an incremental suffix e.g "_" & i

like so:
maxItems = Request.Form("num")

for i = 1 to maxItems
response.write "<blah blah blah field name='fld_" & i & "'>"

you know the rest..
next

on ur post you send ur maxitems value
and on ur transaction page you simply loop through the items that were sent
eg.

for i = 1 to maxItems
strSentField = Request.form("fld_"&i)
next

ya know?
"Emmett Power" <Em****@Silico-Research.com> wrote in message
news:6e**************************@posting.google.c om...
Hi,

I have a small online survey in two parts designed to allow users to
rank a few organisations that they have dealings with from a large
list of organisations. I want the users to be able to rank a number
of organisations at the same time rather than going through a form for
each one.

At the moment the survey has two pages. The first page allows the user
to select a number of organisations from the list. This selection is
saved in a table in an Access database with five fields: ID, User,
Organisation and Ranking.

The second page loops through the data from the database selected by
user and presents the list of organisations in a table with a row for
each record. The table has a ranking field for each organisation. The
user enters numeric data in this field to rank the organisation.

So far so good. Where I am having problems is in updating the database
with the data from the form. What I need to do is loop through each
line of the table on the form, select the record from the database,
update it and then move to the next item.

The form has a field for each record with the same name so using
Request.Form("FieldName") to grab the data from the form doesn't seem
to work.

I am sure that there must be a way of achieving what I want do: but I
can't get it.

I'd appreciate any suggestions or pointers.

Thanks in advance for any help.

Regards
Emmett Power

Jul 19 '05 #4

P: n/a

Guys,

Thanks for the suggestions. I'm going to try them out this weekend.

Regards

Emmett
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 19 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.