473,804 Members | 3,502 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ASP UPDate database looping through form fields

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("F ieldName") 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
4 5943
How about;

<%
strString1 = Request.form("I ma_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****@Silic o-Research.com> wrote in message
news:6e******** *************** ***@posting.goo gle.com...
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("F ieldName") 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
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.Ke y(Item) & ": " & "</td><TD>"
response.write "<TD align=left vAlign=top WIDTH=33% colSpan=3> "
Response.Write Request.Form.It em(Item) & " " & "</td><TD>"
response.write "<TD align=left vAlign=top WIDTH=33% colSpan=3> "
Response.Write Request.Form.It em(Item).Count & "</td></tr><tr><TD>"
Next
Response.Write "</TABLE> "
%>
</BODY>

</HTML>

"Emmett Power" <Em****@Silic o-Research.com> wrote in message
news:6e******** *************** ***@posting.goo gle.com...
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("F ieldName") 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
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("n um")

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("f ld_"&i)
next

ya know?
"Emmett Power" <Em****@Silic o-Research.com> wrote in message
news:6e******** *************** ***@posting.goo gle.com...
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("F ieldName") 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

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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
2217
by: Roy Adams | last post by:
Hello people I've recently been woring with multiple insert from text fields and got that woking fine thanks to the help from people from this forum now i'm trying to deal with multiple update, I'm pretty much using the same script but it isn't working properly I have a text field in a form with a text field called color, in a repeated region, that shows the amount of colours for the item that your viewing it submits to another page that...
4
4082
by: Roy Adams | last post by:
Hi posting again because no answer to previous.. tring to loop through a recordset and update a record, thing is it only updates the first record in the table rather than searching through the entire table or records returned, and updating a record if certain criteria is met. shouldn't the while loop do this? I know my syntax must be wrong, but difficult to work out how or where table = String(Request.Cookies("table"));
0
2409
by: Chris Hall | last post by:
The records in my database are displayed in a form as follows: %> <form action="report-ammend1.42.asp" method="post"name="form"> <table border=1> <% x = 1
16
3880
by: robert | last post by:
been ruminating on the question (mostly in a 390/v7 context) of whether, and if so when, a row update becomes an insert/delete. i assume that there is a threshold on the number of columns of the table, or perhaps bytes, being updated where the engine just decides, screw it, i'll just make a new one. surfed this group and google, but couldn't find anything. the context: we have some java folk who like to parametize/
2
2851
by: devine | last post by:
Hi All, I am trying to send an automatic email when an update has been made. My update statement will updates 6 fields, and dependant on one of the fields, I would like to send an email using CDO. Once the update is made, I am trying to re-query the database to retrieve all the fields that need to be included in the email, but it's just not working for me!! This my code to update <% Set Conn = Server.CreateObject("ADODB.Connection")...
2
19615
by: Brett | last post by:
My database has 2 tables: Table1 & Table2. If a field is not null on a record in table2, then the not null fields in table1 that correspond to the records in table1 needs to be updated to match the field in table2. What I have is a form that is linked to Table2. If the users want to change a field in the main database (table1), they fill the change in to the form (which is linked to table2) If there is no change to the field, they simply...
16
3502
by: Ian Davies | last post by:
Hello Needing help with a suitable solution. I have extracted records into a table under three columns 'category', 'comment' and share (the category column also holds the index no of the record in a hidden field) I wish the user to be able to edit the data in the table, so I have extracted the records into hiddenfield, textareas, dropdown list and checkbox so that they can make changes. I named these elements as arrays and wish to run an...
3
2451
by: Slower Than You | last post by:
I am trying to write an SQL UPDATE statement for an MSAccess table and am having some problems getting my head around it. Can anyone help? TableName: CustTransactions TransactionKey AutoNumber (Primary Key) CustomerID Long Integer (Non-unique index) AmountSpent Double CustSelected Boolean What I would like to do is, for all of the records in descending order
2
2641
by: sirdavethebrave | last post by:
Hi guys - I have written a form, and a stored procedure to update the said form. It really is as simple as that. A user can go into the form, update some fields and hit the update button to update the information which is stored in a SQL database. In testing we noticed that the form was updating correctly but the update mechanism was also updating the first record of the table in the sql database every time. No error messages are on...
0
9571
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10561
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10302
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10069
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9132
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6845
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5505
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4277
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.