2013-03-14 97 views
1

我有一个动态表单。根据用户的选择从下拉菜单中使用php和ajax未知数的新输入字段被添加到表单中。问题是,当我提交表单时,它忽略了使用ajax生成的输入。我究竟做错了什么?动态表单部分用ajax更新

xmlhttp.onreadystatechange=function() 
{ 
. 
. 
. 
if (xmlhttp.readyState==4 && xmlhttp.status==200) 
    { 
document.getElementById("1").innerHTML="Proceed."; 
document.getElementById("5").innerHTML=xmlhttp.responseText; 
    } 
} 
xmlhttp.open("GET","invoice_ajax.php?q="+ test,true); 
xmlhttp.send(); 

当我把新的输入

<form method="post" NAME="mainform" action="pdfinvoice.php"> 
<div><input type="hidden" readonly name="Owner_City" value="<?php Get_City();?>"></div> 
<div><input type="hidden" readonly name="Owner_Post" value="<?php Get_post();?>"></div> 
... 
<div> <span id="5">Ajax inputs</span></div> 
</form> 
+3

您不包括任何代码或HTML源代码。这就是你做错了什么:) – 2013-03-14 23:44:37

+0

你确定那些动态构建的''字段有'name'属性吗? – 2013-03-14 23:46:11

+0

所有这些人都有像foo []这样的名字,因为他们的计数是未知的 2013-03-14 23:51:14

回答