Not once I saw that in the form all checkboxes have one name name="check[]" . Apparently, this is an array. How to successfully take it by post and put it in a loop through the usual echo operator? Well, or maybe there is documentation somewhere on this?
|
1 answer
<?php if (isset($_POST['check'])){ $check=$_POST['check']; foreach ($check as $ch) { echo $ch.'<br />'; } } ?> <form action="" method="post"> <input type="checkbox" name="check[]" /> <input type="checkbox" name="check[]" /> <input type="checkbox" name="check[]" /> <input type="submit" value="Go" /> </form> Something like that. In general, a useful thing is to transfer the form values to an array, then it is easier to process and collect values. You can use multidimensional arrays. name = "check [test1] []", name = "check [test2] []". To see what you take from the post - use the print_r function, it will graphically display everything
|