Q:

foreach in PHP - how to transfer the values in a variable?

so the problem is, I have a HTML form with checkboxes as an input-option.
I want to save all the selected options as a string(!) in one variable.
I'm pretty sure the solution is a foreach-loop, but mine doesn't work. It only returns the last selected value.
How can I fix this?
HTML    
<form action="" method="post">
<label>category:<br/>
     one <input type="checkbox" name ="ber[]" value="one"><br/>
     two <input type="checkbox" name ="ber[]" value="two"><br/>
     thr <input type="checkbox" name ="ber[]" value="three"><br/>
     fou <input type="checkbox" name ="ber[]" value="four"><br/>
</form>

PHP
foreach ($_POST['ber'] as $value) {
$ber = "$value. ', '"
}

A:

This is called "implode an array":
$ber = implode(',', $_POST['ber']);
echo $ber;
// or simply
echo implode(',', $_POST['ber']);

