Select Options ~ "multiple" attribute
Hi All,
Below, I have listed a method of storing a "multiple" select options in a database, but I am not sure if this is a good method. If not, please give me some suggestion or other methods to do so(like using checkboxes instead?).
I have 6 options that an user can choose from from a select menu. Out of the 6 options, I want them to be able to pick a maximum of 4 options.
Therefore, what I did is to include the "multiple" attribute to the <select> object. So, my codes will now looks like this:
<select name="agency" multiple>
<option>Accounting & Auditing</option>
<option>Administrative & Office Support</option>
<option>Airport</option>
<option>Animal Care</option>
<option>Health</option>
<option>Courts</option>
</select>
Now my question is, what is the best method to store this in a database, so that it will make searching easy? Also, how should my database be designed? Should I have separate columns in the database for each of the 6 options, or should I store all 4 of the selected options in ONE column?
Do you get the idea of what I am trying to do?
Thank you.
Leon
|