Problems with \r\n in form
Posted: Tue Nov 10, 2009 2:44 am
Good morning.
Got a really infuriating problem I just can't seem to solve. Let me try to explain.
I have a contact form on my website. The form works in three sections.
1) http://www.didymus.org.uk/new_contact/contact.php
This asks for a visitor's name, e-mail address and comments. Visitors also have to enter a CAPTCHA code before clicking SUBMIT which passes these fields to;
2) http://www.didymus.org.uk/new_contact/check.php
Here's where the problem occurs. When the <textarea> named comments from step 1 is displayed in the <textarea> of the same name in step 2, it adds /r/n if the user has used a carriage return.
So typing:
LINE 1
LINE 2
LINE 3
in step 1 is displayed in step 2 as
LINE1\r\nLINE2\r\nLINE3
The visitor then confirms the information and presses SUBMIT again. The data is then sent to SENDMAIL.PHP.
3) http://www.didymus.org.uk/new_contact/sendmail.php
Sends the e-mail and displays a confirmation message.
Feel free to play around with my contact page to see what I mean.
In short, what I'm asking is what code would I use in step 2 (CHECK.PHP) to remove the unwanted /r/n and (preferably) convert this code in to a simple HTML carriage return?
Many thanks in advance for your help.
KD.
Got a really infuriating problem I just can't seem to solve. Let me try to explain.
I have a contact form on my website. The form works in three sections.
1) http://www.didymus.org.uk/new_contact/contact.php
This asks for a visitor's name, e-mail address and comments. Visitors also have to enter a CAPTCHA code before clicking SUBMIT which passes these fields to;
2) http://www.didymus.org.uk/new_contact/check.php
Here's where the problem occurs. When the <textarea> named comments from step 1 is displayed in the <textarea> of the same name in step 2, it adds /r/n if the user has used a carriage return.
So typing:
LINE 1
LINE 2
LINE 3
in step 1 is displayed in step 2 as
LINE1\r\nLINE2\r\nLINE3
The visitor then confirms the information and presses SUBMIT again. The data is then sent to SENDMAIL.PHP.
3) http://www.didymus.org.uk/new_contact/sendmail.php
Sends the e-mail and displays a confirmation message.
Feel free to play around with my contact page to see what I mean.
In short, what I'm asking is what code would I use in step 2 (CHECK.PHP) to remove the unwanted /r/n and (preferably) convert this code in to a simple HTML carriage return?
Many thanks in advance for your help.
KD.