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
  • 6
    What do you need 1500 input fields for? Commented Apr 2, 2012 at 13:37
  • 1
    What version of PHP and web server do you use? Commented Apr 2, 2012 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. Commented Apr 2, 2012 at 13:40
  • Try increasing post_max_size in php.ini (php.net/manual/en/ini.core.php#ini.sect.data-handling) Commented Apr 2, 2012 at 13:44
  • Maybe you can do some client side optimisation. You can only post edited/changed input fields instead of posting everything. Commented Apr 2, 2012 at 14:00

4 Answers 4

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.

Sign up to request clarification or add additional context in comments.

2 Comments

PHP 5.3.3-7 installed but still got those attributes in the config. Setting them to 2000 did fix the problem
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.
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 

Comments

1

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

2 Comments

also, it appears IIS allows only 200kb check : stackoverflow.com/questions/2880722/is-http-post-limitless
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.
0

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.