Thanks, I didn't solved problem this way, but looks a lot lot easier than what I have wrote.
I shall take a look at template also. However I made a function that receive array of selected value, while loop to sort out which one to sent or not.
Have nice day!