How to read if a checkbox is checked in PHP?

后端 未结 18 961
刺人心
刺人心 2020-11-22 07:54

How to read if a checkbox is checked in PHP?

18条回答
  •  盖世英雄少女心
    2020-11-22 08:41

    You can check the corresponding value as being set and non-empty in either the $_POST or $_GET array depending on your form's action.

    i.e.: With a POST form using a name of "test" (i.e.: , you'd use:

    if(isset($_POST['test']) {
       // The checkbox was enabled...
    
    }
    

提交回复
热议问题