Dropdown list options in an array

sOftGuRu

New Member
I'm after some "best practice" advice here.I have always preferred to store dropdown list options in an array, rather than a database table. One of the main reasons for this is that it is a lot easier to re-arrange options as I wish. For example I have an array like this:\[code\]$sources=array( 1=>'Google', 2=>'Bing', 3=>'Yahoo',);\[/code\]This is just a simple one I have put here to illustrate what I mean. The array key is actually the value that is submitted in the form, and the array value is the text that appears on the dropdown option.The submitted value is stored in the database as an integer (as per above), and I can then query the array to get the corresponding textual value to display on the page.Am I going about this in the proper way, or should I be storing the options in the database rather than an array?
 
Back
Top