I have a textarea in my form where user will enter data line by line. I am processing it using $_POST
. I have to separate each line by a comma while echoing it in php
the text area content like this
233
123
abf
4c2
I tried with below code
$array = array($_POST['devices']);
$device = implode(",", $array);
echo $device;
But it not showing commas between each value, rather I will get plain values like
233 123 abf 4c2
How can I show it like
233,123,abf,4c2
All above values are part of the text area,