2014-10-10 34 views
0

我使用php动态创建HTML表单。 htmlform上的input框的名称也是动态创建的。 当我在动态创建的htmlform上点击submit并使用方法post将数据推送到服务器时。 如何在form的操作页面上调用动态创建的input框的名称? 换句话说,当我点击submit时,如何获取我的input框的名称传递给我的phpform提交表单时检索动态创建的html输入文本框

function add_textbox($label, $name) { 
    myprint("<label>$label <br><br><input type=text name=$name onblur = \"anschecker(this.value)\"></label><br><br>"); 
} 
+1

你可以做 “的foreach($ _ POST为$ data_form){//东西}” – kraysak 2014-10-10 02:58:17

回答

1

只需使用

<?php  
    if(isset($_POST)){ 
     foreach($_POST as $value){ 
      echo $value; //here you will get the values of each field in the form 
     } 
    } 
?> 
0

它将通过您的代码传递。

如果您想在您的PHP代码中找到传递给您的名称,可能需要使用类似下面的语句。

foreach($_POST as $key => $value){ 
    // The key will be the name of the value passed in this loop. 
}