By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,987 Members | 1,592 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,987 IT Pros & Developers. It's quick & easy.

text received via POST

P: n/a
Hi All
I am sending a textarea field via POST to a form.

What happens is that all occurences of ' " and & in the text received via
$_POST[] in that form are now preceded by a \

What is causing this and how can I avoid it ?

I would like to receive the text as seen in the textarea field.

I am using php 4.2.1

Thanks in advance
Heinz

Jul 17 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Heinz wrote:

Hi All

I am sending a textarea field via POST to a form.

What happens is that all occurences of ' " and & in the text received via
$_POST[] in that form are now preceded by a \

What is causing this and how can I avoid it ?

I would like to receive the text as seen in the textarea field.

I am using php 4.2.1

Thanks in advance
Heinz


Try stripslashes().

Regards,
Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 17 '05 #2

P: n/a
Heinz wrote:
Hi All
I am sending a textarea field via POST to a form.

What happens is that all occurences of ' " and & in the text received via
$_POST[] in that form are now preceded by a \

What is causing this and how can I avoid it ?

I would like to receive the text as seen in the textarea field.

I am using php 4.2.1

Thanks in advance
Heinz


$plaintext = stripslashes($text);

They're being added automatically by your php settings to protect you
from SQL insertion attacks.

Jul 17 '05 #3

P: n/a
Kevin Thorpe <ke***@pricetrak.com> writes:
I am sending a textarea field via POST to a form.

What happens is that all occurences of ' " and & in the text received via
$_POST[] in that form are now preceded by a \

What is causing this and how can I avoid it ?

I would like to receive the text as seen in the textarea field.

I am using php 4.2.1


$plaintext = stripslashes($text);

They're being added automatically by your php settings to protect you
from SQL insertion attacks.


....specifically, by the setting of magic_quotes_gpc, which you can check
by calling get_magic_quotes_gpc(). It's a good idea to make this
check before calling addslashes() or stripslashes() on form data
to find out if altering the data is necessary. If you neglect to
make this check, then the code will probably misbehave if the setting
of magic_quotes_gpc is ever changed.

--
Michael Fuhr
http://www.fuhr.org/~mfuhr/
Jul 17 '05 #4

P: n/a

"Heinz" <lu*********@yahoo.com> wrote in message
news:bp*************@ID-25174.news.uni-berlin.de...
Hi All
I am sending a textarea field via POST to a form.

What happens is that all occurences of ' " and & in the text received via
$_POST[] in that form are now preceded by a \

What is causing this and how can I avoid it ?

I would like to receive the text as seen in the textarea field.

I am using php 4.2.1

Thanks in advance
Heinz

Thanks to ALL of you for helping me here.
I use now :

if (get_magic_quotes_gpc())
$text=stripslashes($text);

and it works :-)

Cheers
Heinz

Jul 17 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.