【发布时间】:2016-01-06 03:51:57
【问题描述】:
我是编程新手,我有一个项目陷入困境。 我有一个表单,我可以在需要时选择添加更多行(克隆行)。这是表格:
<form method="post" action="values.php">
<table>
<tr>
<th>Code</th>
<th>Description</th>
<th>Quantity</th>
<th>Price</th>
</tr>
<tr class="clone">
<td><input type="text" name="cod[]" id="cod" class='input' /></td>
<td><input type="text" name="desc[]" id="desc" class='inputp'/></td>
<td><input type="text" name="qt[]" id="qt" class='input' /></td>
<td><input type="text" name="price[]" id="price" class='input' /></td>
</tr>
</table>
<p>
<a href="#" class="add" rel=".clone">Add Line</a>
</p>
<input type="submit" value=" Submit " />
</form>
当我提交这个表单时,它给了我多个数组,所以它们就在这里。
Array
(
[cod] => Array
(
[0] => 10
[1] => 12
)
[desc] => Array
(
[0] => description for the code 10
[1] => description for the code 12
)
[qt] => Array
(
[0] => 1
[1] => 20
)
[price] => Array
(
[0] => 100.00
[1] => 200.00
)
)
如何将这些数据插入到 mysql 中? 这是我的第一篇文章,如果我写错了,请见谅。
【问题讨论】:
-
你试过的sql查询在哪里?
-
为了准确回答这个问题,我们需要查看您的数据库结构,并且了解您迄今为止尝试过的内容也会有所帮助。我投票结束这个问题,因为它不清楚。如果您可以编辑您的帖子以添加有关您尝试过的内容以及您遇到的具体问题的详细信息,我们可以投票重新提出问题。如果您的问题仅仅是您不知道如何使用数据库,我建议您寻求教程——不知道如何编码不是我们可以客观地帮助您解决的问题。