error occurred in getting checkbox value |
09-11-2018, 09:45 PM
(This post was last modified: 09-11-2018, 11:35 PM by kvanaraj. Edit Reason: post controller function ) Code: <input type="checkbox" id="mycheck2" name="certid[]" Code: A PHP Error was encountered Code: controller
That looks like code from view file, not from controller, however because you are using name="certid[]", it's likely that you are looping over 0-6 indexes, where POST variable only sends values that were checked, so it might only have 1 value in certid array, if only one box was ticked.
Check your POST data that comes in. (09-11-2018, 10:53 PM)Pertti Wrote: That looks like code from view file, not from controller, however because you are using name="certid[]", it's likely that you are looping over 0-6 indexes, where POST variable only sends values that were checked, so it might only have 1 value in certid array, if only one box was ticked. controller file also attached. output Array ( [0] => 1_2 [1] => 2_2 [2] => 3_2 [3] => 4_2 [4] => 5_2 [5] => 6_ [6] => 7_ )
First, when you use input name="array[]", you can't really trust indexes, if you select first and third item from one array, and second and fourth item from second array, you get:
PHP Code: $array1[ So as fist thing, you ought to find a way to include related metadata (in your case, matching certid) somehow in the name/array that comes back. |
Welcome Guest, Not a member yet? Register Sign In |