I have a Textarea with this in it:
Test can't talk<br />
Test
When I send it to my preview page I use this:
$Comments = htmlspecialchars("$_POST[CustComments]", ENT_QUOTES);
$Comments = str_replace("
","<br />", $Comments);
It then shows this on the preview page:
Test can't talk<br />
Test
When I go back to edit it, in the edit page code I have this.
$Comments = str_replace("<br />","
", $_POST['CustComments']);
$Comments = htmlspecialchars($Comments, ENT_QUOTES);
But it shows this:
Test can't talk
Test
Where is this extra break coming from and how do I get rid of it?
UPDATE: Per a suggestion on the edit page I have this.
$Comments = htmlspecialchars($_POST['CustComments'], ENT_QUOTES);
And that shows this:
Test can't talk
<br />Test
Again where is this extra <br />
coming from? If I use strreplace
it will show like this
Test can't talk
Test
Using just this:
$Comments = nl2br($_POST['CustComments']);
It shows this:
Test can't talk<br />
<br />Test
Again a random <br />
is added.