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

  • @Casablanca Is javascript disabled in your browser? 13 years 39 weeks ago
  • Been listening to my loved #lastfm tracks for the past week via the chrome plugin goo.gl/kF48s and now my Recommended tracks are awesome! 13 years 39 weeks ago
  • @Casablanca I'm proud! 13 years 40 weeks ago
  • HTML5 Presentations make me happy, especially when they're about HTML5 goo.gl/Fx9Sp 13 years 41 weeks ago
  • @philhawksworth goo.gl/TLwWd 13 years 41 weeks ago
  • @philhawksworth for some reason I imagine you walking around with a monocle in one eye, pointing at code and stuff with a cane! 13 years 42 weeks ago
  • Ooh, the #ux prototyping in code bootcamp looks good http://www.uxbootcamp.org/ Go code! How about prototyping in #Drupal? 13 years 46 weeks ago
  • @markboulton You could do it with #Drupal n/o premium module goo.gl/JLUxN and the role sub module of Ubercart goo.gl/z4mxT goo.gl/dZ0SF 13 years 46 weeks ago
Oliver Polden