you can maintain 2 arrays and you can capture the onclick event to see if the checkbox is selected the checkbox, based on which you can push or remove the item from array
code to check if checkbox is checked
http://www.w3schools.com/jsref/prop_checkbox_checked.aspcheck this for finding adding removing items from array
http://www.swartzfager.org/thoughts/post.cfm/jquery-tip-finding-adding-and-removing-values-from-arraysyou can simply concatenate the array values by using array.join
http://www.w3schools.com/jsref/jsref_join.asp