<SCRIPT LANGUAGE="JavaScript"> function checkbox (field) { for (i = 0; i < field.length; i++) { if(field[i].checked == true) { uncheckAll(field); } else { checkAll(field); } } } function checkAll(field) { for (i = 0; i < field.length; i++) field[i].checked = true ; } function uncheckAll(field) { for (i = 0; i < field.length; i++) field[i].checked = false ; } </script> <form name="myform" action="checkboxselect.php" method="post"> <b>Your Favorite Scripts & Languages</b><br> <input type="checkbox" id="list1" name="list[]" value="1">Java<br> <input type="checkbox" id="list1"name="list[]" value="2">Javascript<br> <input type="checkbox" id="list1" name="list[]" value="3">Active<br> <input type="checkbox" id="list1" name="list[]" value="4">HTML<br> <input type="checkbox" id="list1" name="list[]" value="5">SQL<br> <input type="checkbox" name="CheckAll" value="Check All"
onClick="checkbox(document.myform.list1)">Select all<br> <input type="submit" value="submit"> <?php echo $listvalue =$_REQUEST['list']; while (list ($key,$val) = @each ($listvalue)) { echo "$val,"; } ?> <br> </form>
No comments:
Post a Comment