473,396 Members | 1,785 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Assign vars from a for loop

for each inputField in Request.Form
for each inputValue in Request.Form(inputField)
response.write inputField & " = " & inputValue & "<br>"
next
next

Let's say this returns:

fld = fish
fld = dog
fld = cat
fld = bird
fld = emu

How can I get those values into a variables that I can then put into a
SQL string?

insert into tbl_tmp
(critter1, critter2, critter3, critter4, critter5)
values
(?????)
Jul 19 '05 #1
6 1281
Dave Karmens wrote:
for each inputField in Request.Form
for each inputValue in Request.Form(inputField)
response.write inputField & " = " & inputValue & "<br>"
next
next

Let's say this returns:

fld = fish
fld = dog
fld = cat
fld = bird
fld = emu

How can I get those values into a variables that I can then put into a
SQL string?

insert into tbl_tmp
(critter1, critter2, critter3, critter4, critter5)
values
(?????)


I think you can simply do this:

Response.Write Request.form("fld")

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #2
For each of the values? Won't that just return the same thing each time?

Bob Barrows [MVP] wrote:
Dave Karmens wrote:
for each inputField in Request.Form
for each inputValue in Request.Form(inputField)
response.write inputField & " = " & inputValue & "<br>"
next
next

Let's say this returns:

fld = fish
fld = dog
fld = cat
fld = bird
fld = emu

How can I get those values into a variables that I can then put into a
SQL string?

insert into tbl_tmp
(critter1, critter2, critter3, critter4, critter5)
values
(?????)

I think you can simply do this:

Response.Write Request.form("fld")

Jul 19 '05 #3
Basically, I want to get all the flds into:

values( )

Bob Barrows [MVP] wrote:
Dave Karmens wrote:
for each inputField in Request.Form
for each inputValue in Request.Form(inputField)
response.write inputField & " = " & inputValue & "<br>"
next
next

Let's say this returns:

fld = fish
fld = dog
fld = cat
fld = bird
fld = emu

How can I get those values into a variables that I can then put into a
SQL string?

insert into tbl_tmp
(critter1, critter2, critter3, critter4, critter5)
values
(?????)

I think you can simply do this:

Response.Write Request.form("fld")

Jul 19 '05 #4
Dave Karmens wrote:
For each of the values? Won't that just return the same thing each
time?

Try it!! It would have taken you 10 seconds to try my suggestion. Instead,
you posted two replies and wasted several minutes of your time ...

The variable will return a comma-delimited list of the values.

Bob Barrows
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Jul 19 '05 #5
See your other post on this topic.

Ray at work

"Dave Karmens" <sp*************@yahoo.ca> wrote in message
news:uX*************@TK2MSFTNGP12.phx.gbl...
For each of the values? Won't that just return the same thing each time?

Bob Barrows [MVP] wrote:
Dave Karmens wrote:
for each inputField in Request.Form
for each inputValue in Request.Form(inputField)
response.write inputField & " = " & inputValue & "<br>"
next
next

Let's say this returns:

fld = fish
fld = dog
fld = cat
fld = bird
fld = emu

How can I get those values into a variables that I can then put into a
SQL string?

insert into tbl_tmp
(critter1, critter2, critter3, critter4, critter5)
values
(?????)

I think you can simply do this:

Response.Write Request.form("fld")

Jul 19 '05 #6
Thanks Bob, that worked.

Bob Barrows [MVP] wrote:
Dave Karmens wrote:
For each of the values? Won't that just return the same thing each
time?


Try it!! It would have taken you 10 seconds to try my suggestion. Instead,
you posted two replies and wasted several minutes of your time ...

The variable will return a comma-delimited list of the values.

Bob Barrows

Jul 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: MuffinMan | last post by:
Hi, I'm trying to create a function which gives the total of time. Now the problem is that the function resets the int. $hour. How can I get them to be saved... I tried global $hour etc... but...
0
by: james | last post by:
I am new to php and need some help getting the session variables into include files. (after-thought, Sorry for the drawn out post but I really, really need help....;) Here's what I'm doing.. ...
3
by: ken.boss | last post by:
I am a python newbie, and am grappling with a fundamental concept. I want to modify a bunch of variables in place. Consider the following: >>> a = 'one' >>> b = 'two' >>> c = 'three' >>>...
11
by: Capstar | last post by:
Hi, I am working on an application, which will run embedded without an OS. The app is build up out of a couple of well defined parts. At first I wanted to keep those parts seperated and use...
3
by: Jon | last post by:
I have a couple of tables I want to load into a dataset and keep around pretty much forever, although they will need to be refreshed every so often. I can either put the dataset into an...
5
by: Chris | last post by:
Is there any difference (memory/speed wise) between these two snipits. I always like to write in snipit 2 style, but was just curious. I'm scared I'd declare a thousand pointers when I don't need...
6
by: Ray Cassick \(Home\) | last post by:
FxCop seems to hate this: Public Class Foo Dim mPrivate count As Integer = 0 .. .. ..
6
by: david | last post by:
I try to use "for" loop to retrieve and assign values in web form. The code is in the following. But it can not be compiled. What I want to do is: txtQ1.Text =...
12
by: Danny Colligan | last post by:
In the following code snippet, I attempt to assign 10 to every index in the list a and fail because when I try to assign number to 10, number is a deep copy of the ith index (is this statement...
19
RMWChaos
by: RMWChaos | last post by:
Previously, I had used independent JSON lists in my code, where the lists were part of separate scripts. Because this method did not support reuse of a script without modification, I decided to...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...
0
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,...

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.