[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 131
  • Last Modified:

& 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>
0
imjusthere
Asked:
imjusthere
  • 2
  • 2
1 Solution
 
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
 
LeeKowalkowskiCommented:
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
 
imjusthereAuthor Commented:
Neat trick.  Thank you.
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now