I have two files. First file is a form and the second file displays result.
First file:
<form action="show.php" method=post>
<textarea name="test" cols=40 rows=6>
</textarea>
<input type=submit value="submit">
</form>
Second file:
<?php
$text = trim($_POST['test']);
$textAr = explode("\n", $text);
for ($i=0; $i<sizeof($textAr); $i++)
{
$link = str_replace(" ", "", $textAr[$i]);
echo $link."---<br>";
}
?>
When I enter in the form for example
one
two
three
the result is:
one ---
two ---
three---
at the end on the strings: one and two there are whitespaces that I can't remove. Can anybody help me with this?
Thanks I used $link = str_replace("\r", "", $textAr[$i]) and now everything is ok