Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IF Browser is sending Get or Post THEN 1

Status
Not open for further replies.

MagnusFox

IS-IT--Management
Jan 12, 2001
51
US
I need some code to find out if the browser is sending data the with the GET or POST method. Something like this:

IF "browser.method = POST" THEN
'Browser is sending data with the POST method
'Use Request.Form
objVar = Request.Form("Var")
Else
'Browser is sending data with the GET method
'Use Request.QueryString
objVar = Request.QueryString("Var")
End If

Thanks
 
If Request.ServerVariables("REQUEST_METHOD") = "POST" Then
'Browser is sending data with the POST method
'Use Request.Form
objVar = Request.Form("Var")
Else
'Browser is sending data with the GET method
'Use Request.QueryString
objVar = Request.QueryString("Var")
End If
 
It will be better to use just
Request("varname") cuz will do all what u want both for Post or Get method, and u dont need to worry witch method is invoked... ________
George, M
 
i was thinking that, too, but gave the information on the Request.ServerVariables Collection Property in case there was another reason for needing to know if it were post or get, ie, maybe not accepting anything from a form with get method.

but if all you need is to be able to get the form field values regardless of form method, then your solution takes the cake.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top