title: sanitize string for use in href with PHP GET
body: <p>I am trying to add a user-defined string to information passed to a third party via href.  So I have something that will look like</p>
  
  <pre><code>&lt;a href="http://thirdparty.com/?data_set=USERSTRING" target="_blank"&gt;Link Text&lt;/a&gt;
  </code></pre>
  
  <p>USERSTRING is known when the page loads so it could be put in the href by php when the page loads, or I can dynamically add it with javascript.</p>
  
  <p>What I don't know is what I need to do to escape any special characters so that the link works and can be read on the other end - USERSTRING could be something really annoying like: [He said, "90% isn't good enough?"]  The data is only used in an auto-generated file name so it doesn't need to be preserved 100%, but I'm trying to avoid gratuitous ugliness.</p>