日期:2014-05-17 浏览次数:20568 次
<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>
$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();