Hello,
I am having some trouble with a user text field inside a form. I want the textfield to show new lines instead of
lines. When I echo or print the entered data out it shows up correctly without the
tags and new lines are created with out any trouble.
However when I print back what the user has typed into that field so they can make any edits to is in the future it shows the
instead of line breaks and if they submit the data again it just appends a new
again.
What I currently has as my script
[php]$var = $_POST[‘user_input’];
$var = nl2br(htmlspecialchars($var));
$var = mysql_real_escape_string($var);[/php]
When I echo it on the users page it shows up correctly. So if a user inputs:
"Hi,
Have A Nice Day"
That’s what the member can see on their profile page. But inside the text field on the edit page they see the following:
Hi,
Have A Nice Day
if they hit the submit button again they see:
Hi,
Have a nice day
so on and so forth.
I want them to only see line breaks in the text field instead of the
tags and I really don’t want to add more
tags at every line-break when resubmitted . When I echo or print it out I am simply placing echo/print $var. What am I doing wrong as I did have it working but something happened and I lost the file and I’m trying to do everything I can to figure it out again.
Thanks for any help.
Anthony