AI编程助手
AI免费问答

php处置批量提交

  2016-06-13 13:24   1255浏览 原创

php处理批量提交

HTML code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->                <form id="formcar" name="formcar" method="post" action="car.php">
                <input type='hidden' name='id[]' value='22' />
                <input type='hidden' name='id[]' value='23' />
                <input type='hidden' name='id[]' value='24' />
                <input type='hidden' name='id[]' value='25' />
                <button type="submit" name="button" class="btn-2">购买</button>
                </form>

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->    $buynum = isset($buynum) && is_numeric($buynum) ? $buynum : 1;
    $id =empty($id)? "" : intval($id);
    $buynum = ($buynum < 1) ? 1 : $buynum;
    $rs = $dsql->GetOne("SELECT id,channel,title FROM #@__archives WHERE id='$id'");
    if(!is_array($rs))
    {
        ShowMsg("该商品已不存在!","-1");
        exit();
    }
    $cts = GetChannelTable($rs['channel']);
    $rows = $dsql->GetOne("SELECT aid as id,trueprice as price,units FROM `$cts[addtable]` WHERE aid='$id'");
    if(!is_array($rows))
    {
        ShowMsg("该商品已不存在!","-1");
        exit();
    }
    $rows['buynum'] = $buynum;
    $rows['title']     = $rs['title'];
    $cart->addItem($id, $rows);
    ShowMsg("已添加加到购物车,<a href='car.php'>查看购物车</a>","car.php");
    exit();


我需要如何修改才能将id提交的内容到php?

------解决方案--------------------
探讨
因为id=的值不是固定的,所以这个好像一点用都没有吧?

php免费学习视频:立即学习
踏上前端学习之旅,开启通往精通之路!从前端基础到项目实战,循序渐进,一步一个脚印,迈向巅峰!

声明:本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系admin@php.cn核实处理。