【发布时间】:2014-05-16 17:55:54
【问题描述】:
我正在努力从动态表单中存储我的数据 - 可以在填充期间添加/删除行。
这种形式的输出是数组:
Array ( [service] => Array ( [0] => 1 [1] => 2 [2] => 3 ) [desc] => Array ( [0] => Complete service - description [1] => Half Service - description [2] => Break Service - description ) [price] => Array ( [0] => 1000 [1] => 500 [2] => 800 ) [income_sum] => 2300 [odeslat] => Odeslat )
表定义:
Column Type Comment
id int(11) Auto Increment
order_id int(11) NULL
servis_id tinyint(4) NULL
price int(11) NULL
desc text NULL
表格定义:
<form action="test.php" method="get" id="form">
<div class='container'>
<select name='service[]'>
<option value=""></option>
<option value="1">Complete Service</option>
<option value="2">Half Service</option>
<option value="3">Break Service</option>
</select>
Description
<input type='text' name='desc[]'>
Price
<input class='income_count' type='text' name='price[]'>
<input type="submit">
</form>
我不知道如何用多个值存储这些多列。 我会使用 FOREACH,但无法将其与多个变量一起使用。
非常感谢, 马丁
【问题讨论】: