Here are the variables:
$ids = array_unique($_POST['id']);
$total_ids = count($ids);
$name = $_POST['name'];
$positions = $_POST['position'];
$total_positions = count($positions);
This is what the print_r shows:
[id] => Array (
[0] => 3
[1] => 7 )
[name] => Array (
[0] => George
[1] => Barack )
[position] => Array (
[1] => Array (
[0] => 01
[1] => 01 )
[2] => Array (
[0] => 01
[1] => 01
[2] => 01 ) )
This is the result which I would like to get on refresh/submit:
[id][0];
[name][0];
[position][1][0];[position][1][1]
[id][1];
[name][1];
[position][2][0];[position][2][1];[position][2][2]
To make the wanted result well clear:
User with [id][0]
is called [name][0]
and works at [position][1][0];[position][1][1]
BUT
User with [id][1]
is called [name][1];
and works at [position][2][0];[position][2][1];[position][2][2]
Please note that [position]s starts with [1], not [0].
How could I display the arrays in the order I showed?
I’m not 100% sure I understand what you need, but to try to match the final-example of the output you displayed I came up with the following:
This will give output similar to: