How get value for unchecked checkbox in checkbox elements when form posted?

前端 未结 11 2460
独厮守ぢ
独厮守ぢ 2020-11-27 17:13

I have a form like below :

11条回答
  •  北荒
    北荒 (楼主)
    2020-11-27 17:41

    try below code

        $myresult = array();
    
        if(!isset($_POST['status_1'])){ 
            $myresult['status_1'] = 0;
        }
        if(!isset($_POST['status_2'])){ 
            $myresult['status_2'] = 0;
        }
        if(!isset($_POST['status_3'])){ 
            $myresult['status_3'] = 0;
        }
    
        echo "
    ";
        print_r($myresult);
        echo "
    "; exit;

提交回复
热议问题