2013-03-14 94 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

回答