Php 循环遍历请求数据数组,然后保存每个组的请求数据

Php 循环遍历请求数据数组,然后保存每个组的请求数据,php,loops,laravel,laravel-5,eloquent,Php,Loops,Laravel,Laravel 5,Eloquent,我有一个脚本,它将动态生成输入字段 $(document).on("click", ".if_married_add_fields", function(e){ $("#if_married_table tbody").append('<tr><td><input type="text" name="children[]" class="form-control" placeholder="Children name" required/></td

我有一个脚本,它将动态生成输入字段

$(document).on("click", ".if_married_add_fields", function(e){
   $("#if_married_table tbody").append('<tr><td><input type="text" name="children[]" class="form-control" placeholder="Children name" required/></td><td><input type="text" name="type_of_delivery[]" class="form-control" placeholder="Type of delivery" required/></td><td><input type="text" name="date[]" class="form-control date_picker" placeholder="date" readonly required/></td></tr>');
   e.preventDefault();
});
因此,如果我要在保存时和保存时循环请求数据,那么在数据库中应该是这样的

1、儿童1、分娩类型1、2015-10-10 2,儿童2,分娩类型2,2015年10月11日 3、儿童3、分娩类型3、2015年10月12日

假设我已经添加了3行,每个列标识有输入字段,然后成功地将其保存到数据库中


有什么想法、线索、帮助、建议吗?

您需要在php中内爆相关的输入字段名称,即内爆(“,”,$\u POST[“children]”);要将数组转换为字符串,以便将数据存储到相关数据库字段中,请注意,我使用的是名为LARAVEL的框架,而不是本机PHP。LARAVEL是用PHP编写的,可以使用本机PHP方法。您需要在PHP中内内爆相关输入字段名称,即内爆(“,”,$_POST[“children]”);将数组转换为字符串,以便将数据存储到相关的数据库字段中。请注意,我使用的是名为LARAVEL的框架,而不是本机PHP。LARAVEL是用PHP编写的,可以使用本机PHP方法。
<table class="table-bordered table" style="min-height: 150px;" id="if_married_table">
                                <thead>
                                    <tr>
                                        <th class="text-align_center">Name of Child/Children</th>
                                        <th class="text-align_center">Type of Delivery</th>
                                        <th class="text-align_center">Dates</th>
                                    </tr>
                                </thead>
                                <tbody>

                                </tbody>
                            </table>
id (auto increment, int, primary), children (varchar 250), type_of_delivery (varchar 250), date (varchar 250)