Roderik wrote:
> I'd like to store the information to generate a combobox (drop down
> menu) in the MySQL database. What is a good way to do this. Store the
> name, value pairs in a separate table apart from the combobox-question
> table or store it in a VARCHAR field as a JSON value?
> Or maybe another way?
IMHO it's best to have a table from where you draw the information used in the
drop down menu, as it's usually a lot easier to manipulate the information in
a good way directly in the database instead of having to do filtering/sorting
in the javascript/jscript.
You don't need to have one table per drop down menu (in case the drop downs
are unrelated to any other data in the database), you can have one table where
you could for example have three columns: name, value, dropdownmenu
Usually the data in the drop down tables are related to the data in the
database, then you can fetch it from the table where it's already stored,
using the row id as the value and the name column (can sometimes require a
join or so).
If the drop down menu is statical, then maybe it's far better just let it be
in the html and not use database at all.
--
//Aho
>> Stay informed about: store combobox info