I have a simple basic HTML form with about 1500 fields. 500 rows have text entries. When form is submitted, $_POST contains only about 130 entries of those 500 rows. post_max_size is high, so it's not that. You can see the barebone sample here:
http://www.dadilja.rs/test.php
If you check the source after submit, you will see that the $_POST data contains entries only until letter F.
So I'm figuring it's some server setting, since there's only HTML on the page, and the behaviour is the same on two different servers - probably some generic setting. If you check the Web console, and inspect Request Body, you will see that the form submits all the data. Any ideas?
Check your php.ini max_input_vars. Default is 1000.
Try to change the max_input_vars, check this as well for more info. Source - link.
Related
We are designing a system for conducting a survey in which it askes user a about 72 questions (Multiple Choice questions)
And when the user submits this will be posted to php page which will save the answer in a MySQL table.
Its works fine and perfectly well when we doing the test with a small number of user
But I observed the when a large amount of users are submitting not all data reaches the server only a part of some users answer (around 65 answer) only reaches the server.But i get data from my all users but some answers aren't compete.
Am using MySql engine : MyISAM
What would be the problem or how can i solve this. is it the problem with some php configuration or mysql (large number of insert statement)
What is the best way to handle larger amount data from a form submission php
Thanks in Advance
There is a limit on POST request size in PHP. You can adjust post_max_size in your php.ini. As for database, I don't know how you are saving them in the database, but there are character/storage limitation on the database as well.
Whenever I'm dealing with large POST data like sending numerous field values through forms, using ajax does wonders! Try using jQuery $.post(), which is the shorthand for $.ajax(). It's quite easy to use, even if you're not that familiar with jQuery :)
You need to Increase max_input_vars from php.ini OR you can set the following code in your .htaccess file.
php_value max_input_vars 3000
You should use the ajax function for post the data..
Go through bellow link,it might help you
https://www.w3schools.com/jquery/ajax_ajax.asp
What is the max lenght of a input text in php post request ?
I need to post in a form symfony a very large json object in one input text but when the input is too large the data is from the input in the symfony controler is null.
I found some answers : set max_input_vars, max_upload_file in php.ini for change the apache configuration but it's does not work.
For example i have a input with value length = 4837112
So i'm asking if anyone know how disable the limit of the input text or set a biggest value to the limit ?
And if it's php or apache or maybe symfony which poses this problems ?
I can't comment yet because I don't have the rep to do so but I'll explain a few things. Also, please post some of your code, it would be very helpful.
When you POST something through PHP, the limit can be set in php.ini (or equivalent) and the httpd service must be restarted to take effect. If it's still not taking effect, then you have to take a few things into consideration.
Am I editing the correct values?
Do I have a non-standard installation like two versions of apache installed?
Do I have an override set somewhere else like htaccess or a setting in your framework?
Is the data REALLY sending?
You'll need to have something like firebug to help you debug this (click on console). If you see the data POST, have it return to you for debug purposes. If it doesn't come back but it does post, it could be one of the above or there's something wrong in your code.
I'm trying to post a large form through php using POST method. My form post script has been working fine until now that the $_POST array got pretty large.
When i print out file_get_contents('php://input'); ,all the inputs that are included in the form, are shown. But when i print out $_POST, it only gets the first part of the form. I've tried to remove rows and then the $_POST method works fine again. As soon as it gets too large, it won't post all data included in the form.
Anyone got any ideas? I've tried to edit php.ini and set post_max_size to a higher value, but it didn't help either.
By default, in lower versions of PHP(< 5.3.9) the number of $_POST variables is limited to 1000. There is no way to change that.
In higher versions you can set max_input_vars to whatever number you wish.
If you're below 5.3.9 there are some work-arounds you can do. For example json_encode the variables and send them as a single variable. The limit of $_POST is set to 8mb by default but can be changed in the php.ini file post_max_size="whatever_size_you_wish_here".
How to increase the number of variables in $_POST:
2 options:
in your .htaccess file do php_value max_input_vars 2000(or whatever)
in the file you're working with ini_set('max_input_vars', 2000);
Try dumping a phpinfo() and look for max_input_vars. If it's there, you can set it in php.ini to a higher number, as you see fit. If you don't see it, it's likely that you didn't receive that exact patch and the number has been hard-coded by your distribution.
Just solved it, apparently my server didn't update max_input_vars for some strange reason. Now that i increased that value it's working.
I have one page with a large form inside: Table with more than 2000 vars.
I know about max_input_vars and in my php.ini I set:
max_input_vars = 3000
But the problem is the same.
If I make the count, only 1000 variables are returned.
When I am using
var_dump(ini_get('max_input_vars'));
The result is 3000:
Do you know where I can be wrong?
I am using symfony, is tehre any difference?
If you exceed max_input_vars you would get a PHP Warning: Input variables exceeded 1000 so it must be related to something else.
First you need to make sure that the browser is sending all the data. You can do some debugging via browser console, eg. serialize the form $('#form').serialize() and inspect it or count the number of inputs within the form, or post the values and inspect the HTTP message; most probably you will find that the browser is not sending the whole form for some reason.
The problem was fixed with the bagonyi's help.
In fact, I was using suhoin and I had to set in my php.ini:
[suhosin]
suhosin.request.max_vars = 10000
suhosin.post.max_vars = 10000
That resolved the problem.
I am using a combination of ajax php and sql. I have a local copy of this program and a live sever run by a company, there is a button that posts a comment, on the local copy you can post a comment of any size, but on the live server I have narrowed it down to about 512 bytes once the comment gets larger than that, no error is generated but the comment isn't added, is there any configuration files concerning MySQL databases PHP or javascript that could limit the amount of data that can be parsed?
Ok there was a get max value paramater in php.ini (under the settings for shino or something like that that was on the live server) that was set to 512 I changed it so now the system can handle 10KB of text for comments
is the action of the form for posting comments GET or POST?
if it's POST: in the php.ini, there's a configuration called post_max_size (documentation), please take a look at that on your local- and production-server and compare the values.
if it's GET: some browsers limit the querystring to aroudn 2kb, so maybe you exceed this... you should use POST instead.
If it were me, I would probably use the "onSubmit" tag on the form an run a quick javascript validation on the input (a function called from onSubmit="return func(this)" will only transmit if func(this) returns true). Simply have it call a function, and if the value of the field has a string length and return a little alert window if there are more than 500 characters. That way you don't necessarily parse or transmit anything you don't have to.
You'll probably want to have a fallback so that someone with javascript disabled can't bypass those limits, but that should work for the majority of your users.