Check/Uncheck checkbox with JavaScript

Javascript: // Check document.getElementById(“checkbox”).checked = true; // Uncheck document.getElementById(“checkbox”).checked = false; jQuery (1.6+): // Check $(“#checkbox”).prop(“checked”, true); // Uncheck $(“#checkbox”).prop(“checked”, false); jQuery (1.5-): // Check $(“#checkbox”).attr(“checked”, true); // Uncheck $(“#checkbox”).attr(“checked”, false);

Get $_POST from multiple checkboxes

Set the name in the form to check_list[] and you will be able to access all the checkboxes as an array($_POST[‘check_list’][]). Here’s a little sample as requested: <form action=”test.php” method=”post”> <input type=”checkbox” name=”check_list[]” value=”value 1″> <input type=”checkbox” name=”check_list[]” value=”value 2″> <input type=”checkbox” name=”check_list[]” value=”value 3″> <input type=”checkbox” name=”check_list[]” value=”value 4″> <input type=”checkbox” name=”check_list[]” value=”value 5″> … Read more