& symbol messing up my input variables

I'm inserting data into my flash file using the code below.  My problem is that in address2 they have an & symbol.  This makes it think there is another variable and I loose everything after the &.  Is there an easy way to fix this?

<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="800" height="800">
  <param name="movie" value="Buckys.swf?address=<%=(RecordsetBC.Fields.Item("loc_address1").Value)%>&address2=<%=(RecordsetBC.Fields.Item("loc_address2").Value)%>" />
  <param name="quality" value="high" />
  <embed src="Buckys.swf?address=<%=(RecordsetBC.Fields.Item("loc_address1").Value)%>&address2=<%=(RecordsetBC.Fields.Item("loc_address2").Value)%>" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="800" height="800"></embed>
</object>
imjusthereAsked:
Who is Participating?
 
LeeKowalkowskiConnect With a Mentor Commented:
You don't need to check whether it contains an &, you just need to URI escape it.  Most languages built for the web have a function to escape a string.  In JavaScript, it's "escape"; PHP, "urlencode"; ASP, "Server.URLEncode"; Flash, "escape".

--
Lee
0
 
LocoTechCJCommented:
Try switching out the "&" for "&amp;"

LTCJ
0
 
LeeKowalkowskiCommented:
... or %26!  %26 is a URI escape, &amp; is a HTML escape and would still be treated as an '&' when consumed.

--
Lee
0
 
imjusthereAuthor Commented:
The client is entering the value of address2 so I don't know if it will contain a & or not. How do I check it to see if it does and then correct it?
0
 
imjusthereAuthor Commented:
Neat trick.  Thank you.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.