PHP: Only 1000 POST-Variables are transmitted
Question by Guest | 2014-10-23 at 10:55
I am running an HTML website containing a great number of checkboxes, drop-down boxes and other input fields (configuration of many settings). All of those fields are part of an HTML form and should be passed to the PHP script when pressing the submit button.
Strangely, not all of the variables are arriving my script. When clicking on the submit button, only the first 1000 fields are transmitted, the rest is cut off. I was able to detect this by calling "echo count($_POST[]);" at the beginning of my PHP script.
What is going on there? Is it an error of PHP? What can I do to transfer all of my variables properly? Of course, it would also be possible to spread the variable to multiple forms, but I worked appreciate it to stay with my old design.
Related Topics
PHP: Write array to individual Variables
Tutorial | 0 Comments
Debian: The package is of bad quality: wrong-file-owner-uid-or-gid
Question | 1 Answer
Android Programming: Receive Responce from HTTP POST Request
Tutorial | 0 Comments
jQuery: Send HTML5 Canvas to Server via Ajax
Tutorial | 0 Comments
HTML Form: Redirection depending on Radiobutton or Checkbox State
Tutorial | 0 Comments
Android Programming: Send data via HTTP POST request
Tutorial | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.
Since PHP version 5.3.9, there is the value "max_input_vars" determining the maximum number of accepted input variables. By default, this value is set to 1000 and could be the reason of your problem.
You can change this value for example via the following entry in the configuration (php.ini):
If your php.ini does not have any value for "max_input_vars", you can just add it.
When using Suhosin on your server, you should also adjust the corresponding values there:
Also the transfered data is truncated when exceeding a defined size. Have a look at the value "post_max_size" in your PHP configuration for this (although, probably, in your case, it is about the number of fields and not about the size of posted data).
After changing the values, you can run phpinfo() to see whether the new changes are active. Please do not forget to restart your server to get the changes applied.
2014-10-23 at 14:03
If you do not have access to your php.ini configuration, you can also use the following entry in your .htaccess file:
Alternatively, depending on your hoster, you can also create a php.ini or a user.ini (since PHP 5.3) in a sub directory.
However, you cannot work with ini_set("max_input_vars", 5000), because PHP do not allow this for this value.
2014-10-23 at 14:11