title: How to collect checked values in checkboxes as a javascript array/string?
body: <p>I want to know how to search the inputs provided by the user in the form of checkboxes in a mysql database. But before that I need to get the checked fields into a javascript array/string so that I can pass it to PHP with the url.</p>
  
  <pre><code>&lt;form&gt;
      &lt;input type="checkbox" id="interests" name="interests" value="Food"&gt;`
      &lt;input type="checkbox" id="interests" name="interests" value="Movies"&gt;`
      &lt;input type="checkbox" id="interests" name="interests" value="Music"&gt;`
      &lt;input type="checkbox" id="interests" name="interests" value="Sports"&gt;`
  &lt;/form&gt;
  </code></pre>
  
  <p>I am able to the above for other form elements such as text and select input but not sure how to do it for checkboxes. Please help.
  Thanks</p>