title: URL/HTML Escaping/Encoding
body: <p>I have always been confused with URL/HTML Encoding/Escaping. I am using PHP, so want to clear somethings up. </p>
  
  <p>Can I say that I should always use </p>
  
  <ul>
  <li><p><code>urlencode</code>: for individual query string parts</p>
  
  <pre><code>$url = 'http://test.com?param1=' . urlencode('some data') . '&amp;param2=' . urlencode('something else');
  </code></pre></li>
  <li><p><code>htmlentities</code>: for escaping special characters like <code>&lt;&gt;</code> so that if will be rendered properly by the browser </p></li>
  </ul>
  
  <p>Would there be any other places I might use each function. I am not good at all these escaping stuff, always confused by them</p>