Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML Form in table does not send all avaiable data via POST

Tags:

post

php

I have a table with 113 rows in it. Every row have 9 cells, where is an input in it, like on this shema:

row_1[td_1],row_1[td_2],[...],
row_2[td_1],row_2[td_2],[...],
row_3[td_1],row_3[td_2],[...]
[...]
row_113[td_1],row_113[td_2],[...]

The problem: when I'm sending this data via POST, I'm only getting data up to the first field of row_112:

[...]  
["row_111"]=>
  array(9) {
    ["tytul"]=>
    string(15) "example element"
    ["pkwiu"]=>
    string(0) ""
    ["jm"]=>
    string(1) "2"
    ["ilosc"]=>
    string(1) "1"
    ["cena_brutto"]=>
    string(5) "74.00"
    ["vat"]=>
    string(3) "23%"
    ["vat_oryginalny"]=>
    string(2) "23"
    ["cena_netto"]=>
    string(5) "60.16"
    ["wartosc_brutto"]=>
    string(5) "74.00"
  }
  ["row_112"]=>
  array(1) {
    ["tytul"]=>
    string(15) "example element" <------
  }

Why am I not receiving the full form data?

The example is avaiable here: http://pastebin.com/ahVqUetJ

On top of script I've just put simply:

<?php
    if(isset($_POST) && count($_POST) > 0) {
        var_dump($_POST);
        exit;
    }
?>
like image 904
PiKey Avatar asked Feb 12 '26 23:02

PiKey


1 Answers

That is because from PHP 5.3.9 they added a limit for max_input_vars, and that limit is 1000.

From your form with 111 rows you get 111*9=999 + 1 (1 from row_112) resulting 1000 variables.

Change in php.ini:

max_input_vars = 3000
suhosin.post.max_vars = 3000
suhosin.request.max_vars = 3000
suhosin.get.max_vars = 3000

or from php:

ini_set('max_input_vars', 3000);

or any limit you want.

like image 61
Mihai Iorga Avatar answered Feb 14 '26 12:02

Mihai Iorga