<html> <head> <title>ThaiCreate.Com Tutorials</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="http://code.jquery.com/jquery-1.8.0.min.js"></script> <script type="text/javascript"> $(window).load(function () { // Check all click $("input[id*='chkAll']:checkbox").click(function () { $("input[id*='chkItem']:checkbox").attr('checked', $(this).is(':checked')); }); // frmMain Delete $("#frmMain").submit(function (event) { var count = $("input[id*='chkItem']:checkbox:checked").length; if (count == 0) { alert('Please select more than one row.'); return false; } if (confirm('Confirm delete : ' + count) == true) { return true; } return false; }); }); </script> </head> <body> <form name="frmMain" id="frmMain" method="post" action="?Action=Delete"> Select Data<br> <table width="400" border="1"> <tr> <td width="50"><input type="checkbox" name="chkAll" id="chkAll"></td> <td width="50">No</td> <td width="100">Username</td> <td width="100">Name </td> <td width="100">Surname </td> </tr> <?php for($i=1;$i<=10;$i++) { ?> <tr> <td><input type="checkbox" name="chkItem[]" id="chkItem<?php echo $i;?>" value="<?php echo $i;?>"></td> <td><?php echo $i;?></td> <td>Win <?php echo $i;?></td> <td>Weerachai <?php echo $i;?></td> <td>Nukitram <?php echo $i;?></td> </tr> <?php } ?> </table> <br> <input type="submit" name="Submit" value="Delete"> </form> </body> </html>