Multi-Select to fetch prices and apply them to a total.

Multi-Select to fetch prices and apply them to a total.

Okay let me try and explain this the best I can. So currently i have a product table with all my products name and prices. I have also set up a Order form for when orders come in. On the orders form i have a multiselect box so i can select all the products the customer has ordered. Is it possible for when i select the products it pulls the prices and applies them to the total. Example if i select product 1 (£10) and product 5 (£2) from the multi select the total would be £12 on my order form etc.

I have something like this but i get an error and it wouldn't add the prices together anyway.
  1. for each name in input.Product_Select
  2. {
  3.     if (Products[ID == input.Product_Select].count()  >  0)
  4.     {
  5.     
  6. a = Products [ID == input.Product_Select];
  7. input.Sub_Total = a.Price;
  8. }
  9. }
Thanks in advanced.