<html> <head> <script type="text/javascript"> function checkAll(cnt) { if(document.getElementById("id_chk_all").checked == true) { for(var c=1;c<=cnt;c++) { document.getElementById("id_chk"+c).checked = true; } } else { for(var c=1;c<=cnt;c++) { document.getElementById("id_chk"+c).checked = false; } } } </script> </head> <body> <? echo '<pre>'; var_dump($_POST); if(isset($_POST['chg_pass'])) { $count = $_POST['acc_count']; for($i=1;$i<=$count;$i++) { if(isset($_POST["chk$i"])) echo "<br>$i checked"; else echo "<br>$i not checked"; } } else { echo "<form action='' method='post'><input type='checkbox' id='id_chk_all' onclick=\"checkAll('200')\"><br><br>"; for($i=1;$i<=200;$i++) { echo "$i<input type='checkbox' name='chk$i' id='id_chk$i'><br>"; } echo "<input type='hidden' name='acc_count' value='200'><input type='submit' name='chg_pass' value='Submit'></form>"; } ?> </body> </html> (Please try to execute my code, so dat u know wats my problem is...) wen i run this page it dumping only 200 values, after 200 it is not posting values. In this code submit button is 201 field, so if click sumbit button, submit action is not doing. can anyone tell why ???
Try this else <html> <head> <script type="text/javascript"> function checkAll(cnt) { if(document.getElementById("id_chk_all").checked == true) { for(var c=1;c<=cnt;c++) { document.getElementById("id_chk"+c).checked = true; } } else { for(var c=1;c<=cnt;c++) { document.getElementById("id_chk"+c).checked = false; } } } </script> </head> <body> <?php echo '<pre>'; var_dump($_POST); if(isset($_POST['chg_pass'])) { $count = $_POST['acc_count']; for($i=1;$i<=$count;$i++) { if(isset($_POST["chk$i"])) echo "<br>$i checked"; else echo "<br>$i not checked"; } } else { echo "<form action='' method='post'><input type='checkbox' id='id_chk_all' onclick=\"checkAll('200')\"><br><br>"; for($i=1;$i<=200;$i++) { echo "$i<input type='checkbox' name='chk$i' id='id_chk$i'><br>"; } echo "<input type='hidden' name='acc_count' value='200'><input type='submit' name='chg_pass' value='Submit'></form>"; } ?> </body> </html> PHP: