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

  • My blog about 'Time is NOT money'... and value http://t.co/g2C6pZy0 12 years 11 weeks ago
  • I've found an excellent query logging and filtering module for Drupal. Not available via http://t.co/U1Xe92Th: http://t.co/2qvg1DgE 12 years 15 weeks ago
  • I've just spotted my first © 2011 at the bottom of a website. 12 years 15 weeks ago
  • @da_lune That's the spirit, oh, too late @gavinbrook, Wordpress is fantastic & now more than a blogging tool but Drupal = more functionality 12 years 19 weeks ago
  • @oliverpolden is having an amazing day for many reasons. I feel like giving back: http://t.co/JvKVVMBF Have a request? use the contact form. 12 years 19 weeks ago
  • The world's population is 7 billion. If a few 'competing' companies mutually helped each other get more customers business would be easy. 12 years 19 weeks ago
  • @Casablanca Amazing photos! Thank you for sharing. 12 years 20 weeks ago
  • Ahh, the Christmas Snow module for Drupal: http://t.co/QzvkQiT2 12 years 20 weeks ago
Oliver Polden