#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2009
    Posts
    126
    Rep Power
    9

    Maximum number of variables in a Form


    I have a Form written in php with a large number of radio buttons (two buttons showing yes and no) on separate lines. The user simply selects yes or no for each line on the Form, presses submit and the database table is updated accordingly.

    This works fine for up to about 600 lines but in excess of this it fails and throws an error message. If I reduce the number of lines then it works fine.

    So, is there a maximum number of variables that can be passed using a Form?
    Can this number be chnaged in php.ini?
    If so, which variable in php.ini?
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,262
    Rep Power
    602
    As far as I know there is no hard maximum. There may be a practical limit based on performance. There is a maximum on the length of a URL (I think somewhere around 2048 characters) so using GET rather than POST can be problematic. I suspect there is more likely an error in your HTML rather than some hard limit. Did you check your HTTPD log for errors?
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. Forgotten Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    16,013
    Rep Power
    9616
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2009
    Posts
    126
    Rep Power
    9
    Thanks for your replies. The complete code is written in php.I enter the values in the variables, submit the Form and therefore retrieve the resultant values using POST. As I said, below (approx) 600 it is okay. But above 600 it does not work. Is there a way of changing max_input_vars in php.ini?
  8. #5
  9. No Profile Picture
    Contributing User
    Devshed Specialist (4000 - 4499 posts)

    Join Date
    Jul 2003
    Posts
    4,262
    Rep Power
    602
    Requinix provided the link with that information. However, if he is correct, you should have gotten an error in the log.
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  10. #6
  11. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2016
    Posts
    75
    Rep Power
    4
    You would want to use a phpinfo() statement to find what the current setting is to first determine if this is where the issue is at. Another possibility is if your server has the Suhosin hardened php patch installed.

    Next, no person is really going to examine that many pieces of data on one or multiple pages, but I hope that you are dynamically producing the form, and using an array for the form field name, so that processing the data could use php array functions.
  12. #7
  13. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2009
    Posts
    126
    Rep Power
    9
    Thanks for your help; it is much appreciated. Yes, I've checked the php.ini file and max_input_vars is set to 3000. The table is written to display some 320 lines with each line containing information about the person in two columns (simply as a radio button). Hence the 600+ values that I am trying to pass. This does not work since installing SSL. If I reduce the number of lines to, say, 50, then it does work. I've not tried to find the limit of the number of lines. Also Suhosin is installed.
  14. #8
  15. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Apr 2009
    Posts
    126
    Rep Power
    9
    Just to let you know that I have solved the problem (or at least my ISP has found the reason).

    The Session limits were being exceeded so he has changed the following in php.ini

    suhosin.post.max_vars =10000
    suhosin.request.max_vars = 10000
    max_input_vars = 10000

    Thanks for your help.

IMN logo majestic logo threadwatch logo seochat tools logo