我想添加具有相同表单控件名称的多个数据。代码工作正常但只有最后一条记录被添加到数据库中。请尽快解决问题:
$acname=$_POST['name'];
$acmob=$_POST['mob'];
$acgen=$_POST['gender'];
$atype=$_POST['accompany'];
foreach($acname as $aname)
{
foreach($acmob as $amob)
{
foreach($acgen as $agender)
{
if($_POST['accompany']=="ac_reg")
{
$qry="insert into accompanyReg(name, mob, email, gender) values('$aname', '$amob', '', '$agender')";
}
}
}
}