I need to create multidimensional array from input form, because I would like pass information to mysql. I created it, but how can I make it associative one? My input:
echo "<input type='number' name='hours_to_save[$my_date][$project[$i]]'/>"
This is how it print now:
array(30) {
["2017-05-01"]=>
array(3) {
["kompan"] => string(1) "2"
["5 ogrodow"] => string(1) "3"
["karolowo"] => string(1) "4"
},
...
}
But I would like like this:
array(30) {
["2017-05-01"]=>
array(3) {
["project"] => "kompan" , ["hours"] => string(1) "2"
["project"] =>"5 ogrodow" , ["hours"] => string(1) "3"
["project"] => "karolowo" , ["hours"] => string(1) "4"
},
...
}
["date"] => "2017-05-01"=> array()