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

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

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"))%>

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.

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

try it:

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

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"), "~", "&")
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.