Submit Form Onchange Checkbox
<p>This is my PHP code:<br/>
I have to make when I check or uncheck a checkbox, then immediately update a value into the database.<br/>
I need to do this with PHP or Javascript.<br/>   </p>

<pre><code>&lt;?php
session_start();
include("head.php"); 
include("dbconnection.php");  // database connectie

if (isset($_SESSION['login']))
{
   echo "&lt;h1&gt;Contacten&lt;/h1&gt;";
   echo "&lt;h3&gt;Welkom ".$_SESSION['login']."&lt;/h3&gt;&lt;br/&gt;";
   include("menu.php");
   $sql = "SELECT * FROM `customers` ORDER BY Created DESC ";  // selecteer uit tabel customers
   echo "&lt;table class='overzicht'&gt;
           &lt;tr style='background-color: lightgray; min-height: 200px;' &gt;
               &lt;td colspan='9'&gt;
                    &lt;a href='#' id='module-tab-1' class='toggle' data-prod-cus='1'&gt;
                       &lt;h1 style='margin-bottom: 0px;'&gt;Alle Contacten&lt;/h1&gt;
                       &lt;div class='left-image hi'&gt;&lt;/div&gt;
                     &lt;/a&gt;
               &lt;/td&gt;
           &lt;/tr&gt;
           &lt;tr style='background-color: orange; display:none;' class='cus1' &gt;
            &lt;th&gt;Allemaal&lt;/th&gt;
            &lt;th&gt;Datum&lt;/th&gt;
            &lt;th&gt;Naam&lt;/th&gt;
            &lt;th&gt;Bedrijf&lt;/th&gt;
            &lt;th&gt;Email:&lt;/th&gt;
            &lt;th&gt;SMS&lt;/th&gt;
            &lt;th&gt;Storing&lt;/th&gt;
        &lt;/tr&gt;";
foreach ($conn-&gt;query($sql) as $row) {
    echo "
        &lt;tr class='cus1' style='display:none'&gt;";
        if ($row['All'] == 1)
            {
                echo "&lt;td&gt;
                    &lt;input type='checkbox' name='all' checked&gt;
                &lt;/td&gt;";
            }
            else
            {
                echo "&lt;td&gt;
                    &lt;input type='checkbox' name='all'&gt;
                &lt;/td&gt;";
            }
            echo "
            &lt;td&gt;
                ".$row['Created']."  
            &lt;/td&gt;
            &lt;td&gt;
                ".$row['Name']." 
            &lt;/td&gt;
            &lt;td&gt;
                ".$row['Company']."
            &lt;/td&gt;
            &lt;td&gt;
                ".$row['Email']."
            &lt;/td&gt;
            &lt;td&gt;
                ".$row['SMS']."
            &lt;/td&gt;
            &lt;td&gt;
                ".$row['StoringsID']."
            &lt;/td&gt;";
    echo "&lt;/tr&gt;";
}
echo '&lt;/table&gt;';
}
else
{
   header("location:index.php");  // ga terug naar het inlogscherm
}
include("Javascripts.php");
</code></pre>

<p>Can someone tell me how to do this?<br/>
I don't know how to do this.<br/>
I saw some examples, but they didn't work out for me.<br/>
I used Jquery but I don't know how to update the database then.</p>