sparky753 Posted October 22, 2007 Share Posted October 22, 2007 I have a PHP web form that pulls records from a database table. Based on the data in the table, the records are displayed with checkboxes that have a value that is equal to the record's ID. To handle this form submission, how do i detect which checkboxes have been checked? If this was a static form, I could handle it based on the name of the field but since the checkbox values are not static, how do i check for all the checked boxes on submission? Thanks.... Link to comment https://forums.phpfreaks.com/topic/74344-deleting-from-database-by-checking-multiple-checkboxes/ Share on other sites More sharing options...
sasa Posted October 22, 2007 Share Posted October 22, 2007 if name of your checkboxs is "chk[]" and value of ID is numeric and form metod is POST on submit page do $ids = implode(', ', $_POST['chk']); $sql = "DELETE FROM table_name WHERE ID IN ($ids)"; Link to comment https://forums.phpfreaks.com/topic/74344-deleting-from-database-by-checking-multiple-checkboxes/#findComment-375638 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.