Search-friendly way to store checkbox values in MySQL?
- by Alex
What is a search-friendly way to store checkbox values in the database?
Currently, checkboxes are processed as an array and values are separated by a ";"
As such:
<input type="checkbox" name="frequency[]" value="Daily"/> Daily
<input type="checkbox" name="frequency[]" value="Weekly"/> Weekly
<input type="checkbox" name="frequency[]" value="Monthly"/> Monthly
The PHP backend runs implode(';', $frequency) and adds the string to the database.
This works fine but it's a nightmare when it comes to searching.
Is there a better way to approach this?