drv13270 2017-08-14 14:22
浏览 38
已采纳

获取包含具有不同名称的输入的表单的数据

I'm using a form of formstack(a website that create dynamic forms), but the problem is that formstack generate inputs with "randoms" names (all the names are field+numbers). So I can't save the answers in my system.

Here are a little part of the code of the form.

<form method="post" novalidate enctype="multipart/form-data" action="../../funciones/borrar.php" class="fsForm fsSingleColumn fsMaxCol1" id="fsForm2779461">

<div class="fsSection fs1Col fsHidden" id="fsSection55289049">
<div class="fsSectionHeader">
<h2 class="fsSectionHeading">Adopción</h2>
</div>
</div>
<div class="fsSection fs1Col fsHidden" id="fsSection55287407">
<div class="fsSectionHeader">
<h2 class="fsSectionHeading">Demandas de violencia intrafamiliar</h2>
</div>
<div id="fsRow2779461-4" class="fsRow fsFieldRow fsLastRow">
<div class="fsRowBody fsCell fsFieldCell fsFirst fsLast fsLabelVertical fsSpan100" id="fsCell55287595" lang="es">
<label id="label55287595" class="fsLabel" for="field55287595">¿Es usted el demandante o el demandado? </label>
<select id="field55287595" name="field55287595" size="1" class="fsField" disabled="disabled">
<option value="Seleccione una respuesta">Seleccione una respuesta</option>
<option value="Demandante">Demandante</option>
<option value="Demandado">Demandado</option>
</select>
</div>
</div>
<div id="fsRow2779461-5" class="fsRow fsFieldRow fsLastRow fsHidden">
<div class="fsRowBody fsCell fsFieldCell fsFirst fsLast fsLabelVertical fsHidden fsSpan100" id="fsCell55287612" lang="es">
<label id="label55287612" class="fsLabel" for="field55287612">¿Hizo constatación de lesiones?                    </label>
<select id="field55287612" name="field55287612" size="1" class="fsField" disabled="disabled">
<option value="Seleccione una respuesta">Seleccione una respuesta</option>
<option value="Si">Si</option>
<option value="No">No</option>
</select>
</div>
</form>

and here I get the answer of the first field

<?php
$preguntas=$_POST["field55287595"];

echo $preguntas;
?>

I can't do the same method putting all the fields because they are more than 200 inputs. There are a way to save all the answers in a array or something like that?

  • 写回答

2条回答 默认 最新

  • dongyuan8312 2017-08-14 14:30
    关注

    You can try:

    foreach ($_POST as $key => $value){
        echo "Answer key ==> ".htmlspecialchars($key)." value ==>   ".htmlspecialchars($value)."<br>";
    }
    

    $_POST variable contains all post values. If there is get method you can use $_GET. And for Both you can use $_REQUEST;

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题