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.
- ONE DATASET which will do the FILTERING
- 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…
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