I have a form on my website. When I submit it to my PHP script I use var_dump($_POST);
to show all the form data that has been submitted. The array follows below.
I'd like to use PHP to run a foreach loop on the following array and group them by the index.
Expected Output:
1 - 111 - 1
2 - 222 - 2
3 - 333 - 3
So each row would have the relevant name, source and level based on the integer in the array element.
Can someone explain how this is done?
array(11) {
["source_name0_id"]=>
string(1) "1"
["source_code0_id"]=>
string(3) "111"
["source_level0_id"]=>
string(1) "1"
["source_name1_id="]=>
string(1) "2"
["source_code1_id="]=>
string(3) "222"
["source_level1_id="]=>
string(1) "2"
["source_name2_id="]=>
string(1) "3"
["source_code2_id="]=>
string(3) "333"
["source_level2_id="]=>
string(1) "3"
["submit"]=>
string(6) "Submit"
}
Thank you!