使用POST在PHP页面之间传输数据的问题 [英] Issues transfering data between PHP pages with POST

查看:146
本文介绍了使用POST在PHP页面之间传输数据的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用POST在PHP页面之间传输值时遇到问题。我在页面底部使用隐藏字段来说明我在页面上有多少项(学生行)。我还有一个过滤选项,可以减少页面上可见的项目数量。当我从过滤页面提交数据时,所有值(包括隐藏的值)都不用担心。当我使用未过滤的页面提交数据时,隐藏的值无法通过(因此我的数据收集不会发生)。

I am having an issue transferring values between pages in PHP using POST. I am using a hidden field at the bottom of a page to state how many items (rows of students) I have on the page. I also have a filter option which reduces the number of items visible on the page. When I submit data from the filtered page, all values (including the hidden ones) get through no worries. When I submit data with the page unfiltered, the hidden values do not get through (and therefore my data collection does not happen).

关键是,这不会发生在我的基于Apache的测试环境中,只有当我将其移动到基于IIS的生产环境时才会发生。

The clincher is, this does not happen in my Apache based test environment, it only happens when I move this to an IIS based production environment.

这是初始页面的屏幕截图(实际数据已经过出于隐私原因删除,显示输入。有12行,每行30个输入(总共360个):

Here is a screen shot of the initial page (actual data has been removed for privacy reasons), which shows the inputs. There are 12 rows of 30 inputs each (360 total):

以下是我需要隐藏字段的HTML代码:

Here is the HTML code with the hidden fields which I need:

<input type="hidden" value="12" name="numStudents">
<input type="hidden" value="10" name="numTasks">
<input type="hidden" value="3" name="numCriteria">
<input class="btn btn-primary btn-large" type="submit" value="Save" name="submit">

以下是接收值的PHP代码:

Here is the PHP code which receives the values:

//Get the general information from the form
$numStudents = $common->clean($_POST["numStudents"], $CON);
$numTasks = $common->clean($_POST["numTasks"], $CON);
$numCriteria = $common->clean($_POST["numCriteria"], $CON);

//Loop to get grades for all students
$output = "";
$flagChange = FALSE;
$count = 0;
for($i = 0; $i < $numStudents; $i++)

当我直接回显$ numStudents或$ _POST [numStudents]的值时,什么都没有出现。

When I echo out the value of either $numStudents or $_POST["numStudents"] directly, nothing appears.

真正令人困惑的是 - 当我有一个列表1或2名学生,未经过滤的数据没有问题(echo显示正确的值)。如前所述,如果我过滤数据以便每个学生只显示6列输入,则数据会毫无问题地发出。

The really confusing thing is - when I have a list of 1 or 2 students, the unfiltered data comes through without an issue (the echo displays the correct value). As mentioned before, if I filter the data so that only 6 columns of inputs are shown for each student, the data comes through without an issue.

IIS是否有最大值POST变量允许的值数量?如果是这样,可以改变吗?我检查了我的PHP.ini文件,post的最大大小设置为8M(这个数据甚至不应该接近)。

Does IIS have a maximum number of values allowed in the POST variable? If so, can this be changed? I have checked my PHP.ini file and the max size of post is set to 8M (which this data should not even approach).

我需要的地方还有其他设置改变?

Is there another setting somewhere I need to change?

推荐答案

因此,我能够重新构建我的搜索查询以找到解决方案。事实证明,PHP中有一个设置,用于POST数组中允许的最大元素数。我的限制设置为默认值1000,我现在已将其提高到3000。

So, I was able to re-frame my search query to find a solution to this. It turns out that there is a setting in PHP for the maximum number of elements allowed within the POST array. My limit was set to the default of 1000, I have now upped this to 3000.

PHP.ini文件中的设置为:max_input_vars

The setting in the PHP.ini file is: max_input_vars

我发现此页面有助于解决此问题:

I found this page helped solve this issue:

$ _ POST最大数组大小

这篇关于使用POST在PHP页面之间传输数据的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆