Home  >  Article  >  Backend Development  >  多行数据组合数组有关问题~真心不会组合了,求教导

多行数据组合数组有关问题~真心不会组合了,求教导

WBOY
WBOYOriginal
2016-06-13 12:43:51701browse

多行数据组合数组问题~~,真心不会组合了,求教导!


类似上面的表单,还没加js,不一定多少行,我要做的是每行一条数据写入数据库。这个数组我就不会组合了
我表单里是如下设置的:

<br />
<table width="100%" border="0" cellspacing="0" cellpadding="0"><br />
  <tr><br />
    <td><br />
    品名:<input name="pinming[]" type="text" value=""><br />
    型号:<input name="xinghao[]" type="text" value=""><br />
    规格:<input name="guige[]" type="text" value=""><br />
    数量:<input name="shuliang[]" type="text" value=""><br />
    单价:<input name="danjia[]" type="text" value=""><br />
    总价:<input name="zongjia[]" type="text" value=""><br />
    </td><br />
  </tr><br />
  <tr><br />
    <td><br />
    品名:<input name="pinming[]" type="text" value=""><br />
    型号:<input name="xinghao[]" type="text" value=""><br />
    规格:<input name="guige[]" type="text" value=""><br />
    数量:<input name="shuliang[]" type="text" value=""><br />
    单价:<input name="danjia[]" type="text" value=""><br />
    总价:<input name="zongjia[]" type="text" value=""><br />
    </td><br />
  </tr><br />
  <br />
</table><br />


获取到的数组是这样的

<br>
array<br>
  'pinming' => <br>
    array<br>
      0 => string '123' (length=3)<br>
      1 => string '123' (length=3)<br>
  'xinghao' => <br>
    array<br>
      0 => string '123' (length=3)<br>
      1 => string '123' (length=3)<br>
  'guige' => <br>
    array<br>
      0 => string '123' (length=3)<br>
      1 => string '123' (length=3)<br>
  'shuliang' => <br>
    array<br>
      0 => string '123' (length=3)<br>
      1 => string '123' (length=3)<br>
  'danjia' => <br>
    array<br>
      0 => string '123' (length=3) <div class="clear">
                 
              
              
        
            </div>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn