It can be done - but its gonna take some effort since you will need to put in check for number of elements picked from database and then populating local variables with that(Offbeat - thats the reason static menus are preferred).
So a generic solution would be - using array and then fetching data from database and assigning values.
There are couple of drawbacks for this DYNAMIC approach -
1. Response time / delay is more then static content
2. Number of elements and their type needs to be checked
3. memory required varies as compared to static content
4. Server load increases ( Both in terms on content fetch and send , if data is more)
ALternate solution if feasable is to use AJAX where only required/related parts are updated/refreshed/fetched on need basis - resulting in efficient solution/code.
But if its a small project where in you are simply taking a few variables /configuration parameters - gievn approach may work. But again - it requires effort, which can be easily downloaded from a few websites free.