title: Download a pdf only if a checkbox is checked
body: <p>i created a php page Download a PDF file only if a checkbox is checked. i open the pdf file when checkbox is click by the user but i need give direct download the PDF file when user click. 
  pls help it</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code> &lt;script&gt;
   function toggleCheckbox(element)
   {
  
     window.open('pdf/Code_of_Med_Ethics-a.pdf') ;
   }
   &lt;/script&gt;</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;input type="checkbox" onchange="toggleCheckbox(this.id)" name="click" value="agree" id="click"} ?&gt; &gt;</code></pre>
  </div>
  </div>
  </p>