Dynamic post display selection

I’m looking to create a form that’ll let users select from check boxes what categories they want the posts that will be displayed to come from, then have a button that’ll submit it and process the wp_query loop with a new variable that has been created based upon the selection. So far, I’ve got the code to get the right files, but can’t find a way to do it dynamically, or string the variables togther and seperate them with commas. The checkboxes will each relate to a category ID. Anyway, here is the code: