3

I've got a form with a lot of elements in it, and when the form is saved, the last third or so of the $_POST variables are not getting saved. The page doesn't sit there forever loading or anything - it saves almost immediately, but the last third of the array just isn't saved to the database.

Here's the kicker -- I've got the code on two different servers. The large array works fine on one of them. The new server is the one that is having problems.

I've reviewed all the obvious php.ini settings, and in all cases, the new server has equal if not larger values than the old server. Things I've checked:

max_execution_time: 90

post_max_size: 256M

upload_max_filesize: 256M

The only difference between the old and new server is that the newer one has a separate DB server.

Anyone have any suggestions on things I could try?

Randall Jamison
  • 299
  • 3
  • 13
  • You could post your form code (HTML and any javascript that may interact with it) as well as code for receiving script. When you say that data is not getting "saved" what does that mean? The data is not POSTed? The data is POSTed but not saved to the DB? – Mike Brant Jan 17 '14 at 17:56
  • 2
    Possible duplication of http://stackoverflow.com/questions/9399315/how-to-increase-maximum-post-variable-in-php – Patrick Moore Jan 17 '14 at 17:58
  • I would also look at your `memory_limit` config settings. – Patrick Moore Jan 17 '14 at 17:59
  • we definetly need the code ! – Francisco Corrales Morales Jan 17 '14 at 18:07
  • There is no javascript interacting. It's a simple form that posts to a new page, loops through a multidimensional array, and saves values to a mySQL database. There's nothing wrong with the code itself, because as mentioned, it's working fine on the first server. This is a server issue. – Randall Jamison Jan 17 '14 at 19:36

1 Answers1

2

Try increasing your max_input_vars setting.

The max_input_vars setting limits how many fields can post in a form. In my experience, when a $_POST array from a form is mysteriously truncated, it's usually due to this setting being too low. Ideally, a warning should display when this happens, but I've found that's not always the case.

Further info: http://www.virendrachandak.com/techtalk/big-forms-and-php-max_input_vars/

Virendra
  • 2,560
  • 3
  • 23
  • 37
ethan
  • 985
  • 6
  • 10