new limit within php: 1000 fields per POST. Does someone know, if the number can be influenced?
In newer PHP-Versions the count of input-fileds per formula (POST) will be limited to 1000 (unverified information). It seams that this limit is already installed in certain builds of 5.2. This causes a lot of problems at our online shop.
Does someone know more about it and if this limit could be influenced by parameters or Vars. I just found max_input_vars, but it seems to be a complete new var of 5.4.RC4 And I'm not sure, if this var will be the one for the POST method.
Solution 1:
max_input_vars
is an attempt for PHP to solve some security issues and when set, it limits your number of inputs (thus, fields in your forms). Also beware of
max_input_nesting_level
And yes - they are configurable. Just edit your php.ini or htaccess values.
Solution 2:
I too have come across this issue, working on a localised installation of my code, and Debian Sid has upgraded to 5.4 RC4 PHP. A form of over 7000 lines with checkboxes (!) suddenly only processed 1001 of these in the $_POST data...head scratching for a few hours.
Made the change in /etc/php5/apache2/php.ini:
max_input_vars = 5000
save, and restart apache, and it's all good now.
Solution 3:
If you cannot/ do not want to increase the server limit, here is another solution
<!-- 10000 checkboxes outside the FORM. You do not want to post this -->
<input class="cbox" type="checkbox" value="1" id="id-1" checked name="id[]">
....
<input class="cbox" type="checkbox" value="10000" id="id-10000" checked name="id[]">
<form method="POST" action="postpage.php">
<input type="hidden" id="cboxes" name="cboxes" class="cboxes" value="" />
<input type="submit" onclick="return clicked();">
</form>
then using jquery
<script>
function clicked() {
var cb = $('.cbox:checked').map(function() {return this.value;}).get().join(',');
$('#cboxes').val(cb);
return true;
}
</script>
Using POST I tested posting 10000 records.
In the server
$cboxes = $_POST['cboxes'];
$cbox_exp =(explode(',', $cboxes));
print_r(count($cbox_exp)); //gives me 10000