954,566 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

passing parameters problem

cannot passmeter cname when wunit data is "Sales & Hrd". can anyone help me out??? appreciate it.



&wid=<%=rs.Fields("wid")%>&warea=<%=rs.Fields("warea")%>&wunit=<%=rs.Fields("wunit")%>&cname=<%=cname%>">Chemical list

Qcdms21
Newbie Poster
17 posts since Jun 2006
Reputation Points: 12
Solved Threads: 1
 

Your problem is with the ampersand in the string data. You should urlencode any data passed through the querystring to catch errors like this, eg:

&wunit=<%=urlencode(rs.Fields("wunit"))%>
Lafinboy
Junior Poster
172 posts since Jul 2004
Reputation Points: 16
Solved Threads: 7
 

Your problem is with the ampersand in the string data. You should urlencode any data passed through the querystring to catch errors like this, eg:

&wunit=<%=urlencode(rs.Fields("wunit"))%>




Hi Lafinboy. Thx 4 help. Thats correct , the problem is the ampersand in the string Sales & Hrd in the wunit parameter. howeva after urlencoding it , i get a type mismatch error. It supposed to pass the parameter for cname(companyname) but it doesn't. Instead it perceives the value after ampersand as another function parameter when i click the chemical list link to chemicallist.asp page.

&wid=<%=rs.Fields("wid")%>&warea=<%=rs.Fields("warea")%>&wunit=<%=rs.Fields("wunit")%>&cname=<%=cname%>">Chemical list.

Qcdms21
Newbie Poster
17 posts since Jun 2006
Reputation Points: 12
Solved Threads: 1
 
bakss
Junior Poster in Training
94 posts since Jun 2006
Reputation Points: 11
Solved Threads: 0
 
Thats correct , the problem is the ampersand in the string Sales & Hrd in the wunit parameter.

You will need to replace the ampersand in the string with a 'safe' character before you use it in the querystring, and then change it back when you use the querystring value. For example:

<a href="chemicallist.asp?comid=<%=rs.Fields("comid")%>&wid=<%=rs.Fields("wid")%>&warea=<%=rs.Fields("warea")%>&wunit=<%=replace(rs.Fields("wunit"),"&","~")%>&cname=<%=cname%>">Chemical list</a>

'// get the querystring value
wunit = replace(request("wunit"), "~", "&")
Lafinboy
Junior Poster
172 posts since Jul 2004
Reputation Points: 16
Solved Threads: 7
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You