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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Variables and form submitting problems

Status
Not open for further replies.

chassid

MIS
Aug 27, 2000
58
0
0
US
All,

I've got a weird problem which should be easy to solve. I am passing a variable from another page. I am using the following code to capture the value of the variable:

strSurveyID = Request( "SurveyID" )

I successfully print the variable if I place it before the If statement which asks if the page has been submitted. This is the code that works:

strSQL = "'"& strSurveyID &"'"
response.write strSQL
If Request.ServerVariables("HTTP_METHOD") = "POST" Then

But, when I try to use the variable inside the above if statment I am not able to print the variable. The page tells me there is no variable there. Such as doing this:

If Request.ServerVariables("HTTP_METHOD") = "POST" Then
strSQL = "'"& strSurveyID &"'"
response.write strSQL

Could anyone help me on how could I use the variable I passed in inside this if statement?

Any help will be greatly appreciated,
Daniel Do you know the Chabad Lubavitch Sheliach in your area?
He is waiting for you!
 
REQUEST_METHOD

is the property you're looking for, instead of HTTP_METHOD

:)
paul ...that whenever any Form of Technology becomes destructive of these Ends, it is the right of the People to alter or to abolish it, and to institute new Technology, laying its Foundation on such Principles, and organizing its Powers in such Form, as to them shall seem most likely to effect their Efficiency of Development
 
chassid,

I would try to check to see if you do get in the IF statement first.

strSQL = "'"& strSurveyID &"'"
response.write strSQL
If Request.ServerVariables("HTTP_METHOD") = "POST" Then
response.write "In POST Method: " & strSQL
response.end
End If

fengshui_1998

 
I have tried both tips given above, but I still get no value for strSurveyID when it is inside the if statements. Any more ideas?

Thanks for the help

Daniel Do you know the Chabad Lubavitch Sheliach in your area?
He is waiting for you!
 
what does this return:

response.write(request.serverVariables("REQUEST_METHOD"))

?? ...that whenever any Form of Technology becomes destructive of these Ends, it is the right of the People to alter or to abolish it, and to institute new Technology, laying its Foundation on such Principles, and organizing its Powers in such Form, as to them shall seem most likely to effect their Efficiency of Development
 
return POST

can this help at all? Do you know the Chabad Lubavitch Sheliach in your area?
He is waiting for you!
 
Hmmm... well I can walk you through how I'd debug it, and since I don't use that, then that's what we'll do. Tell me what the output of this is:

if request.serverVariables("REQUEST_METHOD") = "POST" then
response.write("I'm post)
else
response.write(&quot;Instead of posting, I'm<br>&quot;)
response.write(request.serverVariables(&quot;REQUEST_METHOD&quot;))
end if

So you can see what that will tell you.

Then, I'd try cstr()'ing and ucase()'ing the result of that just to see if that might clear it up:

if ucase(cstr(request.serverVariables(&quot;REQUEST_METHOD&quot;))) = &quot;POST&quot; then
response.write(&quot;now it's working&quot;)
else
response.write(&quot;nope, try again&quot;)
end if

See what those give you and post back.

paul
penny1.gif
penny1.gif
 
chassid,

I would try what paul suggested, that seems about right.

You could also try the following:
Do you have control of the page that the variable is passed from? I think that the forms method has been set to GET, i.e: METHOD=&quot;GET&quot;, or it may not have a been set at all. Setting it to POST should fix the problem.

Hope this helps,
Jim :)
 
shouln't <b>strSurveyID = Request( &quot;SurveyID&quot; )</b> be Request.Form or Request.QueryString? Or am I really this bad at ASP?? hehehe


Kevin
 
?can't edit my own replies? I though I could use <> for formating in here....owell
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top