我正在使用像这样的复选框和texfield构建表单
$sector = [
['name'=>'Electrical','id'=>1],
['name'=>'Automobile','id'=>2],
['name'=>'Repairing','id'=>3],
['name'=>'Blacksmith','id'=>4]
]
?>
<?php for each($sector as $value){ ?>
<input type="checkbox" name="work_experience_sector[]" value=" <?php echo $value['id'] ?>">
<input type="text" name="work_experience_sector_experience[]" class="form-control border-input">
<?php }?>
我想在表单提交
之后检查类别值以及经验年份eg:
category-1 and experience-2
category-2 and experience-4
我试过这个
foreach($_POST['work_experience_sector_experience'] as $key=>$value){
echo 'category'.$_POST['work_experience_sector'][$key].'expe'.$value.'<br>';
}
但问题是没有按正确顺序获取值