Website Forms not saving in Wordpress, Drupal or PHP

On very large forms (with lots of form elements) you can find that your form does not save. This is due to a PHP setting max_input_vars. The default setting for this is usually 1000. That means that if the form has more than 1000 elements then elements past 1000 will be omitted. Therefore the form can save partially.

This can be particularly prevalent in permissions forms that have multiple roles and multiple permissions e.g. 100 permissions and ten roles will take you to the limit quite easily.

There are various ways to change this setting either in your php.ini file max_input_vars = 4000 or it can be put in a .htaccess file php_value max_input_vars 4000.

If you are changing your Apache server configuration in php.ini then you probably know what you are doing, if not then the exact steps may vary but will probably be something like:
* locate php.ini This shows you where your php.ini is
* sudo nano /etc/php5/apache2/php.ini Use the path from above
* Change ; max_input_vars = 1000 to max_input_vars = 4000 or another appropriate number
* Save and quit
* Restart Apache sudo apache2ctl restart

The downside? Yes there is some. The PHP documentation says that a large setting can make your site more susceptible to denial of service attacks.

Post new comment

By submitting this form, you accept the Mollom privacy policy.

User login

Author of...

  • Very impressed with yell's 3D maps, simply amazing: http://www.yell.com/maps/ 14 years 51 weeks ago
  • So much compelling about #ubuntu #lucid, but at the same time, stuff I can't live without in #kubuntu that deffinitely isn't in ubuntu 15 years 1 week ago
  • Scratch that! #ubuntu does have mouse wheel volume control, just not with the thingy open ooooooh! 15 years 1 week ago
  • Ok, lucid #ubuntu still doesn't let you control volume with your mouse wheel via the system tray icon, dissappointing 15 years 1 week ago
  • The Gimp resynthesizer plugin came in handy quicker than I thought it would: http://2tu.us/1xx3 15 years 2 weeks ago
  • Ohh, content-aware fill in #CS5, oooooooohhhhhhh, resynthesizer already been in Gimp for years: http://2tu.us/1xx3 15 years 3 weeks ago
  • @drupalninja There's a module for that! http://2tu.us/1xw4 15 years 3 weeks ago
  • See, programming by trial and error is foolproof... if you don't give up. 15 years 4 weeks ago
Oliver Polden