Form Tools
/r/n characters in textarea fields - Printable Version

+- Form Tools (https://forums.formtools.org)
+-- Forum: Form Tools (https://forums.formtools.org/forumdisplay.php?fid=1)
+--- Forum: API (https://forums.formtools.org/forumdisplay.php?fid=17)
+--- Thread: /r/n characters in textarea fields (/showthread.php?tid=537)

Pages: 1 2


/r/n characters in textarea fields - harpon - Feb 26th, 2010

I've set up a multi page form based on the form tools registration demo using the api.
On the review page carriage returns in the user data are converted to /r/n in textarea fields which is also sent to the database like this. Is this expected behaviour? can the carriage returns be maintained or the /r/n characters be removed? also ' characters are escaped with a /
Please forgive my inexperience any help on this would be great, as it is my texrarea fields are just a mess.


RE: /r/n characters in textarea fields - martin_undefined - Feb 27th, 2010

(Feb 26th, 2010, 8:59 AM)harpon Wrote: I've set up a multi page form based on the form tools registration demo using the api.
On the review page carriage returns in the user data are converted to /r/n in textarea fields which is also sent to the database like this. Is this expected behaviour? can the carriage returns be maintained or the /r/n characters be removed? also ' characters are escaped with a /
Please forgive my inexperience any help on this would be great, as it is my texrarea fields are just a mess.

Hi,

The ' being escaped with / sounds like magic quotes might be enabled. Not sure if this would account for the /r/n behaviour though. What version of PHP are you running?

More on Magic Quotes


RE: /r/n characters in textarea fields - harpon - Feb 27th, 2010

Thanks for the reply - PHP Version 5.2.6-1+lenny4
magic_quotes_gpc Off
magic_quotes_runtime Off
magic_quotes_sybase Off
on my pc running firefox the registration demo http://demo.formtools.org/
behaves the same way, is this the same for you?
would be great to get this sorted.


RE: /r/n characters in textarea fields - martin_undefined - Feb 28th, 2010

(Feb 27th, 2010, 11:41 AM)harpon Wrote: Thanks for the reply - PHP Version 5.2.6-1+lenny4
magic_quotes_gpc Off
magic_quotes_runtime Off
magic_quotes_sybase Off
on my pc running firefox the registration demo http://demo.formtools.org/
behaves the same way, is this the same for you?
would be great to get this sorted.

Seems like we can eiliminate magic quotes as being the cause!

When you say you are seeing this on the demo, do you mean on the admin review or when it is submitted?


RE: /r/n characters in textarea fields - harpon - Feb 28th, 2010

(Feb 28th, 2010, 7:35 AM)martin_undefined Wrote:
(Feb 27th, 2010, 11:41 AM)harpon Wrote: Thanks for the reply - PHP Version 5.2.6-1+lenny4
magic_quotes_gpc Off
magic_quotes_runtime Off
magic_quotes_sybase Off
on my pc running firefox the registration demo http://demo.formtools.org/
behaves the same way, is this the same for you?
would be great to get this sorted.

Seems like we can eiliminate magic quotes as being the cause!

When you say you are seeing this on the demo, do you mean on the admin review or when it is submitted?

thanks again for your continued support
I have attached a screen shot of the registration demo filled with the default values.
I have added some "new lines" highlighted by red to demonstrate the problem I'm having.
[attachment=45]
I cannot log into the admin account to view the entry in database,
so what do you think?


RE: /r/n characters in textarea fields - martin_undefined - Feb 28th, 2010

Hmm - not actually seen this happen on any of my installs (yet). I do see the same as you when I visit the demo form.

This is making me think that it is probably something to do with mysql_real_escape_string.

So, I'm guessing that this is being employed here to stop code injections (emphasis on the guessing).

Sorry - but I can't shed any more light on it.


RE: /r/n characters in textarea fields - reddevil45 - Mar 4th, 2010

Doesn't the creator answer questions, if he wrote it I would assume he had some insight.


RE: /r/n characters in textarea fields - Ben - Mar 7th, 2010

Hey guys,

Sorry I haven't been around much the last few days.

Interesting thread. I haven't encountered this problem on my own installations at all, but sure enough - there it is in the demo.

I'm afraid I'll need some time to investigate this. I'll let you know when I figure something out.

- Ben


RE: /r/n characters in textarea fields - reddevil45 - Jun 17th, 2010

Bringing it to the top as it has not been fixed yet.
Oh an clean up all that oil whille your at it. JK and sarcasm is all I can afford sorry.


RE: /r/n characters in textarea fields - Mike - Sep 28th, 2010

This works for me:

PHP Code:
<textarea name=message><?=stripslashes(str_replace('\r\n'"\n"$fields["message"]))?></textarea> 

You can check it here (please, don't send us any submissions, it's not demo form Wink)