My output is like this:-
when i print_r ($aResultData)
Array ( [0] => Array ( [parent] => SK336 [child] => CP ) [1] => Array ( [parent] => SK336 [child] => PES ) [2] => Array ( [parent] => SK995 [child] => MS ) [3] => Array ( [parent] => SK995 [child] => LSW ) [4] => Array ( [parent] => SK995 [child] => GES ) [5] => Array ( [parent] => SK995 [child] => RSW ) )
Now I want to show this data into a checkbox in php.
parent child
checkbox SK336 CP
checkbox SK336 PES
checkbox SK995 MS
checkbox SK995 LSW
checkbox SK995 GES
checkbox SK995 RSW
and a submit button
and after submit checkbox (it depends what i am selected) and finally it stores in to another database what i can do ?
You can do like:
Hope this helps
EDIT:
If you want to check all child checkbox if parent is selected then you need to c=use jQuery and also had to change PHP code:
PHP Code:
JS CODE:
NEW EDIT :
If you want to uncheck the parent when a child is unchecked and check the parent when all the child are selected you can use this:
PHP CODE:
JS CODE:
This thing works 🙂