过帐重复表行的值

时间:2016-04-19 17:11:28

标签: html angularjs html-table http-post

我有下表:

My table figure

该表格来自此代码:

<table class="table table-bordered">
    <thead>
        <tr>
        </tr>
    </thead>        
    <tbody>
        <tr ng-repeat="1 in [1, 2, 3, 4, 5]">
            <td>Name: <input type="text" ng-model="name" size="40" /></td>
            <td>Amount: <input type="text" ng-model="amount"/></td>
            <td>Date: <input type="date" ng-model="date"/></td>
        </tr>
    </tbody>
</table>
<center><button>Send</button></center>

如何发布这些行的值?

1 个答案:

答案 0 :(得分:0)

将信息作为数组发布应该会有所帮助。将您的tbody更改为此类

<tbody>
<tr ng-repeat="1 in [1, 2, 3, 4, 5]">
    <td>Name: <input name="table[]" type="text" ng-model="name" size="40" /></td>
    <td>Amount: <input name="table[]" type="text" ng-model="amount"/></td>   
    <td>Date: <input name="table[]" type="date" ng-model="date"/></td>
</tr>
</tbody>

并使用table检索$_POST['table'],这会给您类似的内容:

array (
      0 => 'John'
      1 => '90'
      2 => 'june'
)