Click to See Complete Forum and Search --> : problem with '&' symbol


john12
11-03-2003, 11:16 PM
Let say

m_licname = "John & sons"

when pass parameter

john.asp?licname=<%=m_licname%>&deptcode=<%=m_deptcode%>

when pass to john.asp... the licname request only "john" whereas & sons and rest of the parameter is truncated...

TQ

itspiyushgupta
11-04-2003, 12:31 AM
You need to replace '&' with "&" followed by "amp;" before passing it as query string parameter.

john12
11-04-2003, 12:40 AM
Originally posted by itspiyushgupta
You need to replace '&' with "&amp;" before passing it as query string parameter.

How? show me an example

thanks

itspiyushgupta
11-04-2003, 12:56 AM
// To replace & with its ASCII Value 26
var strlicname = <%=m_licname%>;
rExp = /&/gi;

john.asp?licname=&' + strlicname.replace(rExp,"%26") + 'deptcode=<%=m_deptcode%>

john12
11-04-2003, 01:02 AM
Originally posted by itspiyushgupta
// To replace & with its ASCII Value 26
var strlicname = <%=m_licname%>;
rExp = /&/gi;

john.asp?licname=&' + strlicname.replace(rExp,"%26") + 'deptcode=<%=m_deptcode%>

thanks

if in my example... john & sons...

can you do it this way...pls help

Thanks

john12
11-04-2003, 01:17 AM
Originally posted by itspiyushgupta
// To replace & with its ASCII Value 26
var strlicname = <%=m_licname%>;
rExp = /&/gi; >>>> where do I declare this part ??? it is a function

john.asp?licname=&' + strlicname.replace(rExp,"%26") + 'deptcode=<%=m_deptcode%>