Using an HTML checkbox to put 1 or 0 into a MySQL table

后端 未结 5 1477
离开以前
离开以前 2020-12-15 22:23

I am using a simple HTML checkbox in a form to put a 1 for checked and a 0 for unchecked in a field called \"subcheck\" in a MySQL table.

Does the checkbox default t

5条回答
  •  情话喂你
    2020-12-15 23:09

    This can be used as follows

    on form page

        
    

    on processing page

        $status = (isset($_REQUEST['status']));
        if ($status == 1 )
          {
            $status = 1;
          }
        else
         {
           $status = 0;
         }
       echo $status;
    

提交回复
热议问题