& symbol messing up my input variables

Posted on 2007-10-09
Last Modified: 2010-04-03
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=",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="" type="application/x-shockwave-flash" width="800" height="800"></embed>
Question by:imjusthere
    LVL 8

    Expert Comment

    Try switching out the "&" for "&amp;"

    LVL 16

    Expert Comment

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


    Author Comment

    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?
    LVL 16

    Accepted Solution

    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".


    Author Comment

    Neat trick.  Thank you.

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to improve team productivity

    Quip adds documents, spreadsheets, and tasklists to your Slack experience
    - Elevate ideas to Quip docs
    - Share Quip docs in Slack
    - Get notified of changes to your docs
    - Available on iOS/Android/Desktop/Web
    - Online/Offline

    Uploading files to the web server has become common part of almost any kind of web application. People use different technologies to solve this, but regardless of the technology used, it is always useful to have some kind of progress indicator shown…
    I have found that much of my time doing support ends up being a constant repetition of the same steps to different people.  Early on I stated using web pages with Frequently Asked Questions (FAQs) to alleviate most of the burden.  Sometimes this jus…
    The viewer will get a basic understanding of what section 508 compliance can entail, learn about skip navigation links, alt text, transcripts, and font size controls.
    The goal of the tutorial is to teach the user how to set there setting in Adobe Flash Media Live Encoder and YouTube for optimal video and audio quality.

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    9 Experts available now in Live!

    Get 1:1 Help Now