Skip to content
Advertisement

Get $_POST from multiple checkboxes

I have 1 form in with multiple checkboxes in it (each with the code):

JavaScript

Where $row['Report ID'] is a primary key in a database -so each value is different.

How would I be able to tell which checkboxes have been checked? (Maybe multiple)

This is for an inbox system and I have a button below that I want (when clicked) to delete all messages (ids of: $row['Report ID']) which have the checkbox’s checked.

Advertisement

Answer

Set the name in the form to check_list[] and you will be able to access all the checkboxes as an array($_POST['check_list'][]).

Here’s a little sample as requested:

JavaScript
User contributions licensed under: CC BY-SA
2 People found this is helpful
Advertisement