Q:

Execute query on button click If checkbox is checked

I want to execute a script if checkbox is checked when I click on the submit button.
I got the following code snippet in my overview.php:
<table style="width: 100%; font-size: 11;">
    <tr>
        <td colspan="6">
            <form method="post" action="update.php" target="_blank">
                <script language="JavaScript">
                function toggle(source) {
                    checkboxes = document.querySelectorAll("input[name^='box[']");
                    for(var i=0, n=checkboxes.length;i<n;i++) {
                        checkboxes[i].checked = source.checked;
                    }
                }
                </script>

                <input type="submit" name="update" value="Update - LoL / BoL">
                <input type="checkbox" onClick="toggle(this)" name="All" value="All">&nbsp;Select all
            </form>
        </td>
    </tr>
    <tr>
        <th>ve067</th>
        <th>ve378</th>
        <th>ve724</th>
        <th>ve725</th>
        <th>ve726</th>
        <th>ve727</th>
    </tr>
    <tr>
        <td>
            <form method="post" action="update.php">
                <input type="checkbox" name="box[1]" value="ve067_LB1">&nbsp;LeagueBot 1<br>
                <input type="checkbox" name="box[2]" value="ve067_LB2">&nbsp;LeagueBot 2<br>
                <input type="checkbox" name="box[3]" value="ve067_LB3">&nbsp;LeagueBot 3<br>
                <input type="checkbox" name="box[4]" value="ve067_LB4">&nbsp;LeagueBot 4<br>
            </form>
        </td>
    </tr>
</table>

And this is a code snippet from my update.php:
<?php
if(isset($_POST['update'] && $_POST['box[4]']) {
    // code here
}
?>

But it does not work for me.

A:

You can do it as I have mentioned in a post on pastebin
Hope it helps you dude.

