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.
<form>
<input type="checkbox" id="interests" name="interests" value="Food">`
<input type="checkbox" id="interests" name="interests" value="Movies">`
<input type="checkbox" id="interests" name="interests" value="Music">`
<input type="checkbox" id="interests" name="interests" value="Sports">`
</form>
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
interests[]
just like that and when submitted directly to PHP, just get the length and loop through it – Andy Jun 13 '12 at 7:25