SQLite checkboxes how to?

Hello,

I am wondering how to store more checkbox datas with checkbox only no submit button or else?
So, when checkbox changeing, change the database straight away.
No need to push submit button, or anything else.
I would like to use sqlite, php only.

I know this code is not working and it is wrong, but I share only because this is how long I reached.
I tried to figure out, but no luck.

<?php
//Create a new SQLite3 Database
$db = new SQLite3('chckbxs.db');
 
//Create a new table to our database
$query = "CREATE TABLE IF NOT EXISTS chckbxs (ischecked BOOLEAN)";
$db->exec($query);

//check insert 1
    $values['checkboxitem'] = isset($values['checkboxitem']) ? true : false;
    if (condition) {
        INSERT INTO chckbxs (ischecked) VALUES (1);
    }

    //DELETE if uncheck

    //READ database and make checked which database value is 1
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>SQLite</title>
</head>
<body>
    <input type="checkbox" name="one" id="one">
    <label for="one">One</label>
    <input type="checkbox" name="two" id="two">
    <label for="two">Two</label>
</body>
</html>
Was this page helpful?