Hi, What is the best way to accomplish this? I have an html table with 5 columns, the first of which contains a checkbox for each record, the rest containing data for each record. I want to select specific records using the checkboxes and copy those records to a database table by posting the data to a processing page. I understand that would require an SQL insert to get the data into the database. My question then is how to code the gathering of the selected records and post them to the processing page? I'd like to avoid Javascript if I can and keep it all PHP. Thanks!
Pure PHP Solution: Code the names of the checkboxes with the extra data and on-post parse and split the form name. For example: <input type="checkbox" name="chk_cat|||34_prod|||123" value="checked" /> when the page loads - fill your checkboxes names so it holds all the data you will need on a post. Then when you post, parse through the entire $_POST ed variables, first find if they are checkboxes (if the contain chk), then parse out the categoryID's and the productID's I've had to do this with many ASP projects... It's not fun or pretty, but it works!
Thanks! Found an easier way you might be interested in. Assign "id[]" to the name of the checkbox. That tells php to create it in an array. Set the value of the checkbox to the variable representing the item id. Then capture $_POST[id] on the receiving processing page. Works like a charm.
so, it would be id=[namehere] inside the checkbox code, and then on the receiving processing page, have it capture the $_POST[id] ?