Sending Query String with single quote (1 Viewer)

fpendino

Registered User.
Local time
Yesterday, 21:01
Joined
Jun 6, 2001
Messages
73
Hopefully, this wonderful forum can help me. I like this forum, but haven't had much web help from it, but here we go. This may be a simple answer, but I just can't seem to figure it out.

If I have a link on a page and want to send a querystring along with the link, and no I can't create a form for this particular link. That's not really the problem, until i try to send a variable that includes single quotes around it. The parameter works when I type it into the address bar, but I can't get the single quotes to appear through the link.

Here's what I'm wanting.
forecastadjdetail.asp?pMonth='1/1/2006'&pdate='1/23/2006'&pbd=35&RptId=104&COLL='701'

This is the code for the link.
strQString = "pmonth='01/01/2006'&pdate='" & request("Date") & "'&PBd=" & kpirs(2) & "&RptID=" & request("cmbReportID") & "&COLL=" & """ & kpirs(1) & """

response.Write "<a href='forecastadjdetail.asp?" & strQString & "' target='_blank'>" & kpirs(5) & "</a>"

Everytime it stops at the first single quote, right after pmonth=.

Thanks in advance for any help.
 

fpendino

Registered User.
Local time
Yesterday, 21:01
Joined
Jun 6, 2001
Messages
73
I found a solution for anyone interested.

Due to using the response.write, I had to surround the file path and target with double quotes.

strQString = "pmonth='01/01/2006'&pdate='" & request("Date") & "'&PBd=" & kpirs(2) & "&RptID=" & request("cmbReportID") & "&COLL='" & kpirs(1) & "'"

response.Write "<a href=" & """" & "forecastadjdetail.asp?" & strQString & """" & " target=" & """" & "_blank" & """" & ">" & kpirs(5) & "</a>"
 

Sergeant

Someone's gotta do it
Local time
Yesterday, 22:01
Joined
Jan 4, 2003
Messages
638
You could also use the URLEncode() function. Try it out when you get a chance.
 

Users who are viewing this thread

Top Bottom