André Zoufahl
André Zoufahl

Reputation: 96

PHP and (too) many input fields

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)

Upvotes: 2

Views: 5391

Answers (4)

Eddy Freddy
Eddy Freddy

Reputation: 1816

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

Upvotes: 2

mbh
mbh

Reputation: 982

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.

Upvotes: 6

Tei
Tei

Reputation: 1416

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

Upvotes: 1

Paul Dixon
Paul Dixon

Reputation: 300865

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

Upvotes: 0

Related Questions