PHP动态添加方括号输入而不通过POST传递

时间:2014-08-07 13:37:01

标签: php jquery codeigniter post

我有动态添加输入的问题。他们没有通过POST。我只得到一个静态的输入组。我正在使用Codeigniter。

这是代码:

<div class="col-sm-10">
    <?php echo form_input('product[]', '', 'class="Value form-control product" placeholder="Produkt" id="product"');?>  
</div>      
<div class="col-sm-2">
    <?php echo form_input('product_id[]', '', 'class="Value form-control" placeholder="ID" id="product_id" readonly') ?>    <br>
</div>      

<div class="col-sm-4">
    <?php echo form_input('price[]', '', 'class="Value form-control" placeholder="Cena" id="product"');?>   
</div>      
<div class="col-sm-4">
    <?php echo form_input('qtty[]', '', 'class="Value form-control" placeholder="Ilość" id="product_id"') ?>    
</div>  
<div class="col-sm-4">
    <?php echo form_input('sum[]', '', 'class="Value form-control" placeholder="Suma" id="product_id" readonly') ?> 
</div>

和我的jQuery添加功能:

$("#addproduct").click(function() {

    var newtr = "<div class='col-sm-12 well'><div class='col-sm-10'><input type='text' name='product[]' value='' class='Value form-control product' placeholder='Produkt' id='product'></div><div class='col-sm-2'><input type='text' name='product_id[]' value='' class='Value form-control' placeholder='ID' id='product_id' readonly><br></div><div class='col-sm-4'><input type='text' name='price[]' value='' class='Value form-control' placeholder='Cena' id='product'></div><div class='col-sm-4'><input type='text' name='qtty[]' value='' class='Value form-control' placeholder='Ilość' id='product_id'></div><div class='col-sm-4'><input type='text' name='sum[]' value='' class='Value form-control' placeholder='Suma' id='product_id' readonly></div></div><br><br>";

    $("#products_container").append(newtr);
    $("#products_container").find('.product').last().autocomplete(options).autocomplete("instance")._renderItem = function (ul, item) {
        return $( "<li>" )
        .append( "<a>" + item.label + "<br>" + item.price + "</a>" )
        .appendTo( ul );
    };  
});

有什么建议吗?

0 个答案:

没有答案