Reputation: 1035
I have a screen with about 135 checkboxes
<input type="checkbox" name="orders_id[] value="1"/>
<input type="checkbox" name="orders_id[] value="2"/>
.........
<input type="checkbox" name="orders_id[] value="135"/>
I check all of the checkboxes and submit, but in $_POST
I only see 107 checkboxes received.
What happened to the missing data?
I changed POST_MAX_SIZE
to 20M but this did not resolve the problem.
I checked on HEADER of browser from Chrome developer tools. I can see all 135 checked data there, but in PHP when I check $_POST['orders_id']
, I just get 107 of them.
Upvotes: 4
Views: 857
Reputation: 41810
With that many checkboxes, if there are other inputs on your form you may be exceeding PHP's max_input_vars
setting. The PHP manual defines this setting as:
How many input variables may be accepted (limit is applied to $_GET, $_POST and $_COOKIE superglobal separately). Use of this directive mitigates the possibility of denial of service attacks which use hash collisions. If there are more input variables than specified by this directive, an E_WARNING is issued, and further input variables are truncated from the request.
You can fix this by increasing that setting in your php.ini, or reducing the number of inputs in your form to fit the limit.
Upvotes: 3