请求不显示数组

时间:2017-02-17 07:53:04

标签: php jquery html laravel laravel-5.1

I am using laravel 5.1 and I am in the middle of the problem.

enter image description here

<script type="text/javascript">

    var counter = 0;

    $(document.body).on('click', ".popCategory", function () {

        var appendcategory = "";

        if (counter < 100) {
            counter++;
            appendcategory += '<input type="text" class="form-control"   name="category[]" placeholder="Category" value="545454" />';
            $('.category_append').append(appendcategory);
        }
    });
</script>

如图所示,我在jquery的帮助下添加了类别,当我提交表单时,我得到的结果如下所示: enter image description here

问题是,当我提交了三个类别的值时,我只获得一个值。你可以看到下面的inspect元素:

enter image description here

<form action="" role="form" method="POST" enctype="multipart/form-data">
  <input type="number" class="form-control" name="current_amount" placeholder="Amount" id="current_amount" min="1"/></td>
    <td><select name="cash_flow_status" class="form-control">
     <option value="cashin">CashIn</option>
        <option value="cashout">CashOut</option>
          </select></td>
         <td class="category_append">
          <input type="text" class="form-control" name="category[]" placeholder="Category" value="545454"/>

             </td>
      <td>
     <a href="javascript:void(0)" class="popCategory">
          <i class="fa fa-plus"></i></a>
       </td>
     <td class="item_append"><input type="text" class="form-control" name="items[]" placeholder="Items"/></td>
      <td>
     <div name="add1" class="btn btn-success cashFlowAddPart" onClick="appendItems()" ><i class="fa fa-plus"></i></div></td>
      <td colspan="2">
      <input type="hidden" name="_token" value="{{ csrf_token() }}">
     <input type="submit" name="submit" id="cashflowsubmit" value="Submit" class="btn btn-success"/>
        </td>
       </form>

有人可以帮助我吗?

0 个答案:

没有答案