This seems too straightforward as first to be a problem - but here is is anyway.
Lets say you have a search form, and you're looking for companies which deal in certain branches of an industry. The form will present a set of set of checkboxes for each question, and the user may choose any amount they want.
What are your favorite colors?
[ ] Red
[ ] Blue
[ ] Yellow
What are your favorite fruits?
[ ] Apple
[ ] Orange
[ ] Banana
Problem No.1
If the user checks red and blue - do we pull from the database rows that match only both? Or do we include rows that also match just red or just blue? In my mind the end-user may expect to see one outcome or the other, or both!
Problem No.2
Baring in mind that the CMS I have to use stores data in arrays for each question. So Company A for the first question may hold values "Red|Blue" or "Red" or "Red|Blue|Yellow" etc - plus the fast that the form I have has 10 categories each with at least 5 checkboxes - how can I translate this into an efficient and optimised query without having to resort to if/else mish mash?
Any help much appreciated.