Get $_POST from multiple checkboxes

前端 未结 5 1493
醉酒成梦
醉酒成梦 2020-11-22 01:03

I have 1 form in with multiple checkboxes in it (each with the code):



        
5条回答
  •  轮回少年
    2020-11-22 01:23

    
    

    And after the post, you can loop through them:

       if(!empty($_POST['check_list'])){
         foreach($_POST['check_list'] as $report_id){
            echo "$report_id was checked! ";
         }
       }
    

    Or get a certain value posted from previous page:

    if(isset($_POST['check_list'][$report_id])){
      echo $report_id . " was checked!
    "; }

提交回复
热议问题