Hmm, your example seems to use javascript. If you want to take values from a database, I would assume you want to use AJAX? Or would you preload the values?
I don't want to launch into a whole script, but I am willing to help you, for free obviously, should you wish to do it yourself. Just send me a PM.
