I’m building an editor that works with .CSV files. I have the application importing the file fine, but now I want the user to be able to select a few columns to work with.
I display the top 5 columns of the file in an HTML table, and in the table TH tag I’m creating some checkboxes at the top of the table like this:
It ends up looking like this:

All of this is wrapped up in a form and when it gets submitted the params contain the IDs of the checked checkboxes/columns.
“0”=>”0″,
“3”=>”3″
I want to find out which columns have been selected, but to my mind, scraping through the params and trying to work out which columns is a tad messy…. is there a way to get the selected checkboxes back as an array so I can just iterate through them? The number of columns is variable.
Solved!
Changed the checkbox generation to this:
and all of the selected columns go into an array called selected_columns. Simple!
Changed the checkbox generation to this:
and all of the selected columns go into an array called selected_columns. Simple!