newbie form post question

S

SStory

Please tell me how I can get the values and items for a form posted using
the post method.

The posting page is HTML and I won't know what's in it ahead of time...

How can I get a item/value pair for it.

I'm sure it is simple but haven't figured it out.

Thanks

Shane
 
K

Karl Seguin

Would somethin glike this work?:

Dim idict As System.Collections.IDictionaryEnumerator = CType(Request.Form,
System.Collections.IDictionaryEnumerator)
While idict.MoveNext
Dim key As String = CStr(idict.Key)
Dim value As String = CStr(idict.Value)
End While

Karl

"SStory >" <[email protected] <remove the 'online.' to send me
mail> wrote in message news:%[email protected]...
 
K

Kevin Spencer

Request.Form is a NameValueCollection, containing the names and values of
all the form fields in the form that posted to the current Page. All you
have to do is iterate through it.

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
http://www.takempis.com
Complex things are made up of
lots of simple things.

"SStory >" <[email protected] <remove the 'online.' to send me
mail> wrote in message news:%[email protected]...
 
S

SStory

give me this...
Specified cast is not valid.

I can't imagine why this should be so ridiculous nor can I found information
on it.

I need info from an HTML page, not the same ASPX page and it will be POST
instead of GET.

I looked at request.form.key, .getvalues.
Not sure what they do and can't find explanation

if you have any more ideas please let me know..


Thanks a bunch,

Shane
 
S

SStory

Thanks a million.... Whew... The docs said it lists all forms on a page so I
was thrown off..

for anybody else who needs to know the easy way of doing this is:

dim i as short

For i = 0 To Request.Form.Count - 1
Response.Write(Request.Form.Keys(i) & "=" & Request.Form.Item(i) & &
"</br>")
Next i
 

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

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,901
Latest member
Noble71S45

Latest Threads

Top