title: Execute query on button click If checkbox is checked
body: <p>I want to execute a script if checkbox is checked when I click on the submit button.</p>
  
  <p>I got the following code snippet in my <code>overview.php</code>:</p>
  
  <pre><code>&lt;table style="width: 100%; font-size: 11;"&gt;
      &lt;tr&gt;
          &lt;td colspan="6"&gt;
              &lt;form method="post" action="update.php" target="_blank"&gt;
                  &lt;script language="JavaScript"&gt;
                  function toggle(source) {
                      checkboxes = document.querySelectorAll("input[name^='box[']");
                      for(var i=0, n=checkboxes.length;i&lt;n;i++) {
                          checkboxes[i].checked = source.checked;
                      }
                  }
                  &lt;/script&gt;
  
                  &lt;input type="submit" name="update" value="Update - LoL / BoL"&gt;
                  &lt;input type="checkbox" onClick="toggle(this)" name="All" value="All"&gt;&amp;nbsp;Select all
              &lt;/form&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;th&gt;ve067&lt;/th&gt;
          &lt;th&gt;ve378&lt;/th&gt;
          &lt;th&gt;ve724&lt;/th&gt;
          &lt;th&gt;ve725&lt;/th&gt;
          &lt;th&gt;ve726&lt;/th&gt;
          &lt;th&gt;ve727&lt;/th&gt;
      &lt;/tr&gt;
      &lt;tr&gt;
          &lt;td&gt;
              &lt;form method="post" action="update.php"&gt;
                  &lt;input type="checkbox" name="box[1]" value="ve067_LB1"&gt;&amp;nbsp;LeagueBot 1&lt;br&gt;
                  &lt;input type="checkbox" name="box[2]" value="ve067_LB2"&gt;&amp;nbsp;LeagueBot 2&lt;br&gt;
                  &lt;input type="checkbox" name="box[3]" value="ve067_LB3"&gt;&amp;nbsp;LeagueBot 3&lt;br&gt;
                  &lt;input type="checkbox" name="box[4]" value="ve067_LB4"&gt;&amp;nbsp;LeagueBot 4&lt;br&gt;
              &lt;/form&gt;
          &lt;/td&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>And this is a code snippet from my <code>update.php</code>:</p>
  
  <pre><code>&lt;?php
  if(isset($_POST['update'] &amp;&amp; $_POST['box[4]']) {
      // code here
  }
  ?&gt;
  </code></pre>
  
  <p>But it does not work for me.</p>