title: Problems with Toggle Switch (sending information to SQL and remaining checked after refresh page)
body: <p>So I have 2 problems with my code:
  1. sending information to the SQL Database
     With my current code, when I press the toggle switch and the switch slides, I can send updates to the SQL Database "BUT" the problem is there are 3 toggle switches in my website and when I tried to press two or more switches at the same time, some updates may not get sent to the database and my information won't get updated.
  2. remaining the checked toggle switches after refreshed page
     As you see, I use PHP to control the HTML website, so I put header('Location: url') in order to redirect to the HTML page and I want the toggle switch to remain checked if the user has checked it.</p>
  
  <p>The toggle switch I'm using is the one similar to iPhone toggle element.</p>
  
  <pre><code>Settings.html (the toggle switches):
  
      &lt;form method="POST" action="settings.php"&gt;
      &lt;label class="switch"&gt;
        &lt;input type="checkbox" name="Streaming" value = "ON"&gt;
        &lt;span class="slider round"&gt;&lt;/span&gt;
      &lt;/label&gt;&lt;/div&gt;&lt;/br&gt;&lt;/td&gt;
      &lt;label class="switch"&gt;
        &lt;input type="checkbox" name="AutoPlay" value = "ON"&gt;
        &lt;span class="slider round"&gt;&lt;/span&gt;
      &lt;/label&gt;&lt;/div&gt;&lt;/br&gt;&lt;/td&gt;
      &lt;label class="switch"&gt;
        &lt;input type="checkbox" name="Notification" value ="ON"&gt;
        &lt;span class="slider round"&gt;&lt;/span&gt;
      &lt;/label&gt;&lt;/div&gt;&lt;/td&gt;
      &lt;div align = "center"&gt;&lt;font face="comic sans ms"&gt;
        &lt;input type="submit" button class="button" value="SUBMIT" name="submit"&gt;
      &lt;/font&gt;&lt;/div&gt;
      &lt;/form&gt;
  
  The php code:
      &lt;?php
      session_start();
  $servername = "localhost";
  $username = "root";
  $password = "";
  $dbname = "XXX";
  
  $conn = new mysqli($servername, $username, $password, $dbname);
  $select = "SELECT * FROM `Settings` WHERE ID = 1";
  $result = $conn-&gt;query($select);
  $row = mysqli_fetch_assoc($result);
  $streaming_check = $row['Status'];
  
  $select = "SELECT * FROM `Settings` WHERE ID = 2";
  $result = $conn-&gt;query($select);
  $row = mysqli_fetch_assoc($result);
  $autoplay_check = $row['Status'];
  
  $select = "SELECT * FROM `Settings` WHERE ID = 3";
  $result = $conn-&gt;query($select);
  $row = mysqli_fetch_assoc($result);
  $notification_check = $row['Status'];
  
  if (isset($_POST['submit'])){
      if((isset($_POST['Streaming']) == "ON") &amp;&amp; $streaming_check == "OFF"){
          $sql = "UPDATE `Settings` SET `Status` = 'ON' WHERE `Settings`.`ID` = 1;";  
          $conn-&gt;query($sql); 
      } 
      else {
          $sql = "UPDATE `Settings` SET `Status` = 'OFF' WHERE `Settings`.`ID` = 1;"; 
          $conn-&gt;query($sql);     
          }
      if((isset($_POST['Autoplay']) == "ON") &amp;&amp; $autoplay_check == "OFF"){
          $sql = "UPDATE `Settings` SET `Status` = 'ON' WHERE `Settings`.`ID` = 2;";  
          $conn-&gt;query($sql);     
      } 
      else {
          $sql = "UPDATE `Settings` SET `Status` = 'OFF' WHERE `Settings`.`ID` = 2;"; 
          $conn-&gt;query($sql); 
      }
      if((isset($_POST['Notification']) == "ON") &amp;&amp; $notification_check == "OFF"){
          $sql = "UPDATE `Settings` SET `Status` = 'ON' WHERE `Settings`.`ID` = 3;";  
          $conn-&gt;query($sql);     
          } 
      else {
          $sql = "UPDATE `Settings` SET `Status` = 'OFF' WHERE `Settings`.`ID` = 3;"; 
          $conn-&gt;query($sql);     
      }
  }
  
  header('Location: settings.html');
  exit;
      ?&gt;
  </code></pre>
  
  <p>I think the php code is still wrong in some point: 
  when I toggle 2 switches at the same time, only one toggle switch will turn 'ON'. Or sometimes none of them turn 'ON'. </p>
  
  <p>What I wanted is, if they slide the toggle switch to 'ON' position, the status for that toggle switch will be updated as "ON". Also, the toggle switch on the website will remain checked. If the user slides the toggle switch to turn 'OFF', the status will be updated as "OFF" and the toggle switch on the website will remain unchecked.</p>