Passing Parameters in a Query String


Passing Parameters in a Query String

You have a link similar to that shown below but it doesn't work.

If the variables MemberName and MemberType were something like "John Doe" and "Senior Member" the link would fail because of the spaces in the variables.

So, replace the spaces by %20 like this

MemberName=Replace(MemberName," ","%20")
MemberType=Replace(MemberType," ","%20")

AccountsLink = "" & MemberName & "&Type=" & MemberType & " target='_blank'>" & "Account Details" & "</a>"

The link will now work, opening up in a new window - get rid of the target='_blank' if you don't want a new window. In you could use the more elegant URLEncode method instead.
it isn't necessary to replace spaces with the url encoded value of %20, all browsers from the last few years, properly read spaces. Server.Urlencode works with asp too. The values you need to be most careful that are encoded are ampersands (&) and equals (=). If those are in a value for a variable, then they will be intepretted as a new set of variable/value.
Thanks jonyah - my version of IE6 was failing on the spaces. I think extensive testing is the answer to see just what works.