When typing values (one per line), example:
valor1
valor2
valor3
valor4
It will return: value1, value2, value3, value4
entra_valores.php
<html>
<body>
<form action="junta.php" method="post">
<textarea rows="10" cols="50" name="valores">
</textarea><br>
<input type="submit" name="enviar" value="Pronto" />
</form>
</body>
</html>
junta.php
<?php
$valores = $_POST['valores'];
$quebra = explode("\n", $valores);
$junta = implode(',', $quebra);
$valores = preg_replace("/\s+/", "", $junta);
echo $valores;
?>