title: Php - Checkbox does not work
body: <p>i try to make checkboxes. When i click checkbox it makes isPremium = 1 if i click a checked checkbox it makes isPremium = 0</p>
  
  <p><strong>However: when i click a checked checkbox it does not work..</strong></p>
  
  <pre><code>&lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8" /&gt;
  &lt;?php
  require 'connectDB.php';
  $mysql = new mysql();
  $mysql-&gt;connect();
  
  $dbResult = mysql_query("select * from profiles");
  
  
  
  
  
  
  echo "&lt;form action='#' method='post'&gt;";
  
  $dbResult = mysql_query("select * from profiles");
  
  
  while ($info = mysql_fetch_array($dbResult)) {
  
      if ($info['isPremium'] == 0)
          echo "&lt;input type=checkbox name='check2[]' id='check2' value=" . $info['id'] . "&gt;";
      else
          echo "&lt;input type=checkbox name='check1[]' id='check1' value=" . $info['id'] . " checked&gt;";
  
      echo $info['profileName'] . "&lt;br /&gt;";
  }
  
  echo "&lt;p&gt;&lt;input type='submit' name='btnPremium' /&gt;&lt;/p&gt;";
  echo "&lt;/form&gt;";
  
  if (isset($_POST['btnPremium'])) {
  
  
      if (isset($_POST['check2'])) {
          $arrPremium = $_POST['check2'];
          foreach ($arrPremium as $result) {
              mysql_query("UPDATE profiles set isPremium=1 where id=" . $result . "");
          }
      }
      else 
      {
          $arrPremium = $_POST['check1'];
          foreach ($arrPremium as $result2) {
              mysql_query("UPDATE profiles set isPremium=0 where id=" . $result2 . "");
          }
      }
  
  
  
  }
  ?&gt;
  </code></pre>
  
  <p><strong>when i click a checked checkbox it makes another checkbox unclick.</strong></p>
  
  <p>This is the checkbox page </p>
  
  <p><img src="https://i.stack.imgur.com/Ngjtw.png" alt="enter image description here"></p>