I have into $_POST array all the data i need.
If I print_r
the array, I see something like this:
Array (
[0_45_115] => 01
[0_46_115] => 01
[0_47_115] => 01
[0_48_115] => 01
[0_49_115] => 01
[0_50_115] => 01
[0_51_115] => 01
[0_52_115] => 01
[0_53_115] => 01
[0_54_115] => 01
[0_55_115] => 01
[0_56_115] => 01
[0_57_115] => 01
[0_58_115] => 01
[0_59_115] => 01
[0_60_115] => 01
[0_61_115] => 01
[0_62_115] => 01
[0_63_115] => 01
[0_64_115] => 01
[0_65_115] => 01
[0_66_115] => 01
[0_67_115] => 01
)
The index i post from the form (the name attr
) doesn't have underscores. For example:
<input type="text" name="0 45 115" value="" />
Let's forget this.
0_45_115
which the index is will provide me all the neccessery data I want to update or insert a new row into my database. The value will saw me the information I want.
The problem is that I don't know how to manage the array. Maybe I must use foreach
method, and the I will use split
function to split the index of each row. Then I will do all the other stuff for insertion/update my database.
I ask how can I use foreach
to take the info (index-data) from $_POST
array.