title: Apostrophes issue while passing as parameter
body: <p>i tried to fix an issue with apostrophes but did not succeed. Please have a look into this and suggest me the needful.</p>
  
  <p>I am fetching a value from database which has apostrophes. I am passing the value using a variable into another javascript function. But because of the apostrophe, the function is not executing. Please have a look into below mentioned code.</p>
  
  <p><strong>PHP code:</strong></p>
  
  <pre><code>&lt;?php
  $Id = $abc-&gt;id;
  $str = $abc-&gt;street; // output: 111 O'CG street
  ?&gt;
  </code></pre>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;a href="javascript:void(0)" onclick="show_details(&lt;?php echo $Id1;?&gt;,'&lt;?php echo $str;?&gt;')"&gt; 
  Display
  &lt;/a&gt;
  </code></pre>
  
  <p>I tried to use the HTML code using backslash as well. But did not overcome the issue.</p>
  
  <p><strong>Code with backslash:</strong></p>
  
  <pre><code>&lt;a href="javascript:void(0)" onclick="show_details(&lt;?php echo $Id1;?&gt;,\"&lt;?php echo $str;?&gt;\")"&gt; 
  Display
  &lt;/a&gt; 
  </code></pre>
  
  <p>Please suggest me. Thanks in advance.</p>