Reputation: 67
I have a multi select box i am using to allow users to select multpile users, this is fine but the $_POST output is an array.
How would i get these values to be formatted like so
100,200,300,400
So i need to echo out the values, add a comma, but dont add the comma for the last value
Any help would be grand.
Cheers
Upvotes: 0
Views: 659
Reputation:
$array = array(100, 200, 300, 400); // Or get from your $_POST value or what have you
echo implode(',', $array); // "100,200,300,400"
Upvotes: 1
Reputation: 42496
You could use implode:
return implode(',', $_POST['users']);
Upvotes: 8