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

Querystring not working

Status
Not open for further replies.

Telsa

Programmer
Jun 20, 2000
393
US
I'm trying to capture the values in the URL that is the result of redirection. The values are in the URL but when I do the following code, I get nothing.


strPDSID = Request.Form("pdsid")

If isempty("strPDSID") Then
strPDSID = request.querystring("pdsid")
End if


Can anyone see why this won't work or give me clues otherwise to get the value? Mary :)

Rule 1: Don't sweat the small stuff.
Rule 2: EVERYTHING is small stuff!! X-)
 
MMmmmm, when you POST something with a FORM, you retrieve a variable value with request.form.
When you call another page with a parameter (test.asp?pdsid=youknow) you use request.querystring.

sometimes you mix both methods, so then it makes sense to write something like this:

' Test the POST method
strPDSID = Request.Form("pdsid")
If strPDSID="" Then
' Test the parameter methode
strPDSID = request.querystring("pdsid")
if strPDSID = "" then
response.redirect "errorpage.asp"
response.end
end if
end if
br
Gerard
 
This page shows up from a redirection (response.redirect "pds_reviewexisting.asp?pdsid=" & Request.Form("pdsid")).

And the URL does show the name/value combo correctly. But apparently the Request.querystring won't capture what is in the URL.

Just can't understand why I can't get the values from the URL! Doesn't make sense to me. Mary :)

Rule 1: Don't sweat the small stuff.
Rule 2: EVERYTHING is small stuff!! X-)
 
Try: server.URLencode("pdsid") br
Gerard
 
Nope, didn't work. Darn! Won't capture it. Very weird.
Mary :)

Rule 1: Don't sweat the small stuff.
Rule 2: EVERYTHING is small stuff!! X-)
 
A) oke, test what we are sending:

change:
response.redirect "pds_reviewexisting.asp?pdsid=" &_
Request.Form("pdsid")

into:

response.write "pds_reviewexisting.asp?pdsid=" &_
Request.Form("pdsid")
response.end




B)
In pds_reviewexisting.asp you have a
cPDSid = request.querystring("pdsid")

[or something like that]

???

br
Gerard
 
Apply first:

Server.Urlencode(myQueryString) before appending it to the redirected URL. Otherwise you cannot send signs like &,$,space and so on.

Hope this helps, s-)

Blessed is he who in the name of justice and good will, shepards the week through the valley of darkness...
 
I'm getting this in the Address field. But my page is not populating.

pds_reviewexisting.asp?pdsid=656

If I hardcode the 656, it works. And I have this at top of page to see if the value is getting captured...

intPDSID = Request.Form("pdsid")
If isempty("intPDSID") Then
intPDSID = Request.Querystring("pdsid")
End if
response.write "PDSID = " & intPDSID


But it's not. Mary :)

Rule 1: Don't sweat the small stuff.
Rule 2: EVERYTHING is small stuff!! X-)
 
Why do you insist on putting the name of a ASP variable inside quotes.
Code:
If isempty("intPDSID") Then
You just asked if the literal string "intPDSID" ISEmpty which it ain't never gonna be because the value inside the literal IS LITERALLY intPDSID.
ASP variables and REQUEST variables ar two different animals.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top