Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Passing hidden variables that contain an ampersand (&) in it 1

Status
Not open for further replies.

CMcC

Programmer
Feb 5, 2002
196
US
Hi - Having trouble passing my hidden variables like names that contain (&) in the hidden variable -
like:

name = trim(request("busname"))
[red]
where busname = Holten, John & Mary
[/red]
Since & is the field separator in asp, Im not quite sure how to convert this data on the .asp side

Is there a way to choose which character I would like to be a field separator?

thanks in advance.
cmcc
 
try this:

name = Server.HTMLEncode(trim(request("busname")))

and then pass in the query string

-DNG

 
HI DNG -
no luck -

thanks anyhow
cmcc
 
Hi DNG-
still no luck!

thanks again-
cmcc

this is the string being passed in the URL
here are the variables (with your suggestion)

Code:
<%
Dim account, name, due
account = trim(request("AccountID"))
name = Server.URLEncode(trim(request("busname")))
due = trim(request("amtdue"))
%>

accountid = 059783
busName = International Linen Rentals & Sales
amtdue = 25.00

the URL when submitted is shown here:
Code:
[URL unfurl="true"]http://www.seminoletax.org/ccpay3.asp?AccountID=059783&busname=INTERNATIONAL%20LINEN%20RENTAL%20&%20SALES%20&amtdo=%20%20%20%20%2025.00[/URL]

you can see where the ampersand is being thrown in:
Code:
20RENTAL%20&%
 
use Server.URLEncode() method at the url string level...

for example:

if strURL=http://www.seminoletax.org/ccpay3.asp?XXXXX

then do Server.URLEncode(strURL)

-DNG

 
hey are you sure that when you do

name = Server.URLEncode(trim(request("busname")))

and if your busname is International Linen Rentals & Sales

you are not getting name as

International+Linen+Rentals+%26+Sales

try this link and see the output...i think you are inserting ampersand at someother place...


-DNG
 
well - im not sure If I can do that -
I have hidden variables that I pass from say, ccget, to ccpay3.
those variable names are
account
busname1
plaindue

See - people can look up some information from a static list- and from there we access our servers and return all information to a page called ccget.asp.

From there they see the information about their account. Then they click a link that takes them to our pay page -ccpay3. So all the while - Im passing hidden variables between 3 pages.


here is how I call this ccpay3.asp page from ccget.asp:

Code:
<P style="MARGIN-TOP: -12px" align=center><STRONG><FONT color=blue 
size=5><A href="ccpay3.asp?AccountID=<% = account %>&busname=<% = Busname1 %>&amtdo=<%=plaindue%>" ><%=linktopay%></FONT></STRONG></P>

I cant do your suggestion, because account, busname1, and plaindue are fields that need to be kept as fields.

Does this make sense? I know - I dont explain very well.
Thanks
 
yeah..i was wrong...did you see my next post...

take a look at that link also...

-DNG
 
yes - I did. But Im not sure how to keep passing the variables to more than one page and keep the name with out the & in it...will continue testing...You get a star for effort ( and skill )
thanks
cmcc
 
to the pass the variable to more than one page...

just do this:

name = Server.URLEncode(trim(request("busname")))

and then put this name variable in a session variable

Session("myname")=name

then you can have Session("myname") avialable to you in the other pages...

-DNG

 
for now, I have transformed the business names to say "and" instead of &.

thanks DNG - will try in the am - im outta here-

thanks so much!
cmcc

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top