There is a checkbox on the page.

<input class="switch__input" name="2fa" id="checkbox1" type="checkbox"> 

How to handle his switch? I try the given, but the table in a DB is not updated.

 if(isset($_POST['2fa'])) { $mysqli->query("UPDATE user SET фact='true' WHERE id='$sesion_id'"); } else { } 
  • фact - Do you have it right in the database? What for? And on the issue - so it is not clear, then? What exactly is wrong - Manitikyl 8:37
  • @Manitikyl act *. It is not clear why it does not work, well, ie, I have a checkbox in the form of a switcher and when I switch it, the values ​​in the database do not change - Midnight
  • So judging by what I see, you do not have a switch, you add a request after the else , and try - Manitikyl
  • @Manitikyl is no use, added to the else clause setting a value to false, but nothing happens at all - Midnight
  • How can I save the checkbox in the past position? Ie it is reset when the page reloads - Midnight

0