Reputation: 199
How to echo an array to a form?
My array
Array
(
[0] => Array
(
[id] => item1
[price] => 300
[quantity] => 1
)
[1] => Array
(
[id] => item2
[price] => 400
[quantity] => 2
)
)
I tried like (codeigniter):
echo form_textarea('detail_prod',print_r($detail));
And I got like
what happen? why the result is 1 ?
It's possible to echo to a form in array format?
Upvotes: 0
Views: 128
Reputation: 2059
Just pass the 2nd parameter true
like below:
echo form_textarea('detail_prod',print_r($detail, true));
For your help: http://php.net/manual/en/function.print-r.php
Hope this will useful.
Upvotes: 1