Last Good Quote: Son's are the seasoning on our lives. - Someone on Facebook

Monday, February 12

ASP and multiple values

A good friend of mine asked me a question about ASP programming. I remember spending quite a while figuring this out the first time I ran into it so I figured I'd share with you.

Question: I've got multiple text input fields on a form. All the input fields have the same name. How do I recover the values in the fields once the form is posted.

Answer:

When this happens all the variables go into an array on the response object. You can access them by selecting thier index value. Like the following
PetsName(0)
PetsName(1)
PetsName(2)

You could also loop the the array and display each value.

for each pName in PetsName
response.write(pName)
next

Thanks Wes for the blog posting.

0 comments:

Post a Comment

Followers