【发布时间】:2017-11-30 11:37:07
【问题描述】:
我有一个获取产品数据库条目的表单。我在一个表单中添加了多行产品,我需要数据库插入方面的帮助。 我希望将数据添加到单行中,并且我有多个数组。
<form id='students' method='post' name='students' action='add-
<div class="table-responsive">
<table class="table">
<tr>
<th><input class='check_all' type='checkbox' onclick="select_all()"/></th>
<th>S. No</th>
<th>BarCode</th>
<th>HSN</th>
<th>Product Name</th>
<th>MRP</th>
<th>CGST</th>
<th>SGST</th>
</tr>
<tr>
<td><input type='checkbox' class='case'/></td>
<td><span name='snum[]' id='snum'>1.</span></td>
<td><input class="form-control" type='text' id='countryname_1' name='countryname[]'/></td>
<td><input class="form-control" type='text' id='country_no_1' name='country_no[]'/></td>
<td><input class="form-control" type='text' id='phone_code_1' name='phone_code[]'/></td>
<td><input class="form-control" type='text' id='country_code_1' name='country_code[]'/> </td>
<td><input class="form-control" type='text' id='cgst_1' name='cgst1[]'/> </td>
<td><input class="form-control" type='text' id='sgst_1' name='sgst1[]'/> </td>
</tr>
</table>
<input type="submit" value="submit">
<button type="button" class='btn btn-danger delete'>- Delete</button>
<button type="button" class='btn btn-success addmore'>+ Add More</button>
</div>
</form>
【问题讨论】:
-
请努力
-
你的表结构和想要的输出是什么?你想要每个产品索引一行吗?全部用逗号隔开?等等。到目前为止,您尝试过什么?
-
你的表格错了---
<form id='students' method='post' name='students' action='add-在这里关闭 -
@kchason- 是的,我需要每个产品索引的行,我尝试了 pair() 和基本方法来存储数组,但我仅限于添加同名数组,但这里我有 5 个不同的名称数组这给我带来了麻烦。
-
@B001 - 谢谢,但我放置表格只是为了对数组有一个公平的想法