Hi
I have a form with a text area that may accepts words as input.
for example:
aaa
bbb
ccc
I want to convert it to string in the form "aaa, bbb, ccc".
The code that I wrote is as follows.
<form name="inpform" method="post" enctype="multipart/form-data" action = 'try2.php' >
<textarea name="textArea" cols="40" rows="6">Enter your Input</textarea>
<input type="submit" value="submit" >
//try2.php
<?php
$textarea = $_POST['textArea'];
print"textarea before is $textarea"; //prints: aaa bbb ccc
$regex = "[ \n\r\t]+"; //done to strip white spaces
$textarea = explode($regex, $textarea);
print ("<br>textarea after is: $textarea<br>"); // prints: Array
$comma_separated = implode(',', $textarea);
print ("<br>$comma_separated "); // does not work: aaa bbb ccc
?>
help appreciated
Thanks