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...

  • Day one of my Drupalipet from the Drupal 7 release party. http://twitgoo.com/1ta7eo 14 years 15 weeks ago
  • At Drupal 7 release party. Can't wait to start using it. Didn't realise how much Microsoft is supporting it! #d7rp_london 14 years 16 weeks ago
  • Drupal 7 is out and I'm the third that commented! http://buytaert.net/drupal-7.0-released #drupal7 14 years 16 weeks ago
  • http://twitgoo.com/1sfadf my attempt at a snowman 14 years 18 weeks ago
  • I signed the "KDE4 as the default environment in Ubuntu" petition! http://petol.org/ubuntu4 #petol 14 years 23 weeks ago
  • @eventsacademy will you be putting your video up on youtube? 14 years 34 weeks ago
  • Extremely impressed with @eventsacademy tonight. Simply amazing what they have achieved. More on the site http://eventsacademy.org.uk/ 14 years 34 weeks ago
  • Ooh... a very compelling reason to finally get a new (Google) tv http://bit.ly/c91D6x 14 years 35 weeks ago
Oliver Polden