2

I've got a html-form with roughly ~1500 input fields* (either text or hidden). The form.action is POST and every inputfield has a unique name (no name=foo[]).

Whenever I try to print every variable of $_REQUEST in PHP after the form is submitted, only the first few entries are printed. In fact, the $_REQUEST variable only contains 1001 items (so about 500 fields are missing).

Any idea why this happens ?

Since data are sent via post not get, the url-limit is not a problem. So I thought that it had something todo with the config of the webserver and that the request was too big. But setting LimitRequestBody to 0 doesn't changed anything in the result.

In terms of memory used by this PHP-array I only read that the size is only limited by the overall memory, which should be more than enough. (keys are about 20chars each, and the value is about 6chars each)

Do I miss something?

*In case you wonder: the navigation consists of about 750 entries, 2 fields per entry (one position for ordering and one for parent if nested)

  • 6
    What do you need 1500 input fields for? – Felix Kling Apr 02 '12 at 13:37
  • 1
    What version of PHP and web server do you use? – Timur Apr 02 '12 at 13:38
  • 2
    How about splitting the form in sections ... 1500 is way too much to change at once anyways. its better for the user and for the server. – MakuraYami Apr 02 '12 at 13:40
  • Try increasing post_max_size in php.ini (http://php.net/manual/en/ini.core.php#ini.sect.data-handling) – jeanreis Apr 02 '12 at 13:44
  • Maybe you can do some client side optimisation. You can only post edited/changed input fields instead of posting everything. – ahmetunal Apr 02 '12 at 14:00
  • or also, have you considered saving changes on the fly, if I edit some input field, just save it with ajax when that field loses focus, this way you onyle send one input field. – ahmetunal Apr 02 '12 at 14:02

4 Answers4

6

Since PHP 5.3.9 there's a new configuration setting called "max_input_vars" which limits the number of input variables. The default setting is 1000. Also check if Suhosin is installed, because there's also a similar setting.

Although, I would recommend to reduce the number of fields if possible.

mbh
  • 982
  • 9
  • 12
  • PHP 5.3.3-7 installed but still got those attributes in the config. Setting them to 2000 did fix the problem – André Zoufahl Apr 02 '12 at 14:07
  • PHP 5.3.3-7 is a legacy distribution maintained by the Debian Security Team and is basically PHP 5.3.3 + latest security fixes. – mbh Apr 02 '12 at 14:13
2

Try to override php_flag max_input_vars.

Add to your .htaccess file or change php.ini

php_flag max_input_vars 1500

There is also a flag for nesting

php_flag max_input_nesting_level 64
Eddy Freddy
  • 1,820
  • 1
  • 13
  • 18
1

Perhaps you exceed the size of a POST? yo could use mime multipart, like people do wen are posting files.

Tei
  • 1,400
  • 8
  • 6
  • also, it appears IIS allows only 200kb check : http://stackoverflow.com/questions/2880722/is-http-post-limitless – Jonathan DS Apr 02 '12 at 13:45
  • I suggested using a multipart form, because is how I solved a similar problem myself. But tranver/Eddy seems to have a more solid solution. – Tei Apr 02 '12 at 13:59
0

Check your php.ini configuration for the post_max_size value - perhaps you have exceeded it?

Paul Dixon
  • 295,876
  • 54
  • 310
  • 348