tage choices based on database values

If you start to go coding way, you will have to be able to understand the code later.

What you are trying to do is to generate a FILTERING-ENGINE, right?
Before you start to go the difficult coding way, maybe you could try first to use 2 different dataset, for your purposes.

  1. ONE DATASET which will do the FILTERING
  2. SECOND DATASET which will SAVE DATA INTO DATABASE.

If you want to go the CODING-WAY either, you can take a look onto this one…

Follow this post till end, you will leran a lot, but you will also have to invest some time, before you get results…

https://community.wix.com/velo/forum/coding-with-velo/database-filtering-and-grouping-including-caching-of-results

Start your CODING-ADVENTURE…

And maybe this one about Dropdowns, could also be useful for you…
https://community.wix.com/velo/forum/coding-with-velo/add-multiple-unique-drop-downs-to-a-code