I think the easiest way to handle this is to make the value for each check box the id (primary key) field for the current record. When the form is submitted, the checkbox field contains a list of all the records to export, so just run you query against that value [i.e. SELECT * FROM my_database...