2016-11-14 64 views
0

我使用Bootstrap和jQuery,並且在將值從FORM傳遞到PHP時遇到了問題,在這種情況下是同一頁面。Jquery使用Bootstrap形成多個字段

我的代碼是:

<tr> 
    <td><input type="text" name="descricao[]" ></td> 
    <td><span class="spanpreco"><input type="text" name="quantidade[]" ></span></td> 
    <td><span class="spanpreco"><input type="text" name="preco[]"></span></td> 
    <td><input type="text" name="subtotal[]" disabled></td> 
</tr> 

然後我的jQuery是這樣的:

$("#adicionar").click(function(){ 
      $("#linha").append('<tr><td><input type="text" name="descricao[]"></td><td><span class="spanpreco"><input type="text" name="quantidade[]" ></span></td><td><span class="spanpreco"><input type="text" name="preco[]"></span></td><td><input type="text" name="subtotal[]" disabled></td></tr>'); 
     }); 

這裏的問題是,當我發佈的數據PHP,每一個欄,我動態添加到表單不會傳遞給PHP,結果行數始終爲1。

有人可以幫我嗎?

+0

只是一個奇怪的問題,這是怎麼'的Twitter bootstrap'有關?我只看到jQuery。也許你會有更好的[Google](https://www.google.nl/search?q=Jquery+form+multiple+fields)結果。 – Xorifelse

+0

你好,你是對的,這是jQuery。謝謝。 –

回答

0

我發現問題,<FORM></FORM>是在錯誤的地方。

感謝和問候,

阿德爾莫

+0

回想起來,我們在哪裏可以找到這個解決方案?顯然這不是答案的一部分。 – Xorifelse

+0

我提交了驗證碼,

爲紅色。謝謝。 –

相關問題