Reputation: 36
I have got a question regarding printing an array of checkboxes in the $_POST When I do:
echo '<pre>';
print_r($_POST);
echo '</pre>';
I can see the Checkboxes which I send through the $_POST How am I able to read only the checkboxes? This is what I currently have:
print_r($_POST['checkboxes[]']);
But this doesn't seem to work
Upvotes: 1
Views: 55
Reputation: 8621
If your checkboxes actually have their name='checkboxes[]'
, then you can access their POST value by doing print_r($_POST['checkboxes']);
. You do not have to include the square brackets when referencing the name of the POST value, the brackets are only there make all of the same named elements post as an array.
Upvotes: 1