if (request()->isGet()) { $ob = input('get.'); $w['name'] = trim($ob['name']); $w['zt'] = "!!!!!"; $w['time'] = time(); $ids = db('goumai')->insertGetId($w); foreach ($ob['zx'] as $val) { $obb['shangpin'] = $val; $obb['aid'] = $ids; db('spid')->insert($obb); } }
HTML代码
<input type="hidden" value="{$vo.item_name}" name="zx[]">
zx是一个数组,foreach将数据排列是一个两表联合插入。