Hello,
I am trying to print an array into a textarea but when I walk through the array, it prints the elements one after another like:
E1E2E3
and I want E1 E2 E3
If I put any html, it just prints it.
Help?
$test = "E1E2E3";
$loop = 0; for ($i = 0; $i < strlen($test); $i++) { $loop++; if($loop%2==0) { $test[$i] $new_test .= "\n"; $loop = 0; } $new_test .= $test[$i]; }
not sure if this work.. try it.
Yea, what you are looking for is the newline symbol "\n". add it on to each of your variables before you print it.
Try this
<? $arr=array("E1","E2","E3"); ?> <form> <textarea rows=3><? echo implode("\n",$arr) ?></textarea> </form>
I need to be shot.
I am not thinking lately and was thinking the \n would print itself verses do a new line and YES I did NOT try it.
I have done like 10 million lines with \n, you would think I would at least try it.
Thanks guys.