POST不同的名称字段

时间:2016-03-10 18:51:39

标签: php

我正在进行一项调查,用户可以在其中创建问题/答案,然后将其显示给最终用户。我遇到的问题是将$pState = []; $stateString = substr($_SERVER['REQUEST_URI'],1);//remove leading slash if($stateString){ $statePairs = explode("/",$stateString); if (count($statePairs)) >= 1 { // Technically unnecessary unless you want to log the fact you didn't find anything. foreach($statePairs as $statePair){ $statePairArray = explode("-",$statePair); if (count($statePairArray) == 2) { // Found two and only two elements $pState[$statePairArray[0]] = $statePairArray[1]; } else { //It is very helpful in log statements to include the values of things that produced unexpected results Log.warn("Invalid key-pair found for statePairArray=" + $statePairArray); } } } else { LOG.warn("No state pairs found for stateString=" + $stateString);//Or some other appropriate log or exception } } 值发布到另一个页面。原因如下:

<input>

我的&lt;输入&gt; 的名称不是静态的。数据库中的id是一个自动编号。

如何在其他网页上检索此内容以执行此操作?提前致谢!

1 个答案:

答案 0 :(得分:1)

我找到了答案。不管怎样,谢谢。

foreach ($_POST as $param_name => $param_val) {
    echo "Param: $param_name; Value: $param_val<br />\n";
}