chris@xxxxxxxxxxxx wrote:
Thanks Jim worked a treat
----- Original Message ----- From: "Jim Lucas" <lists@xxxxxxxxx>
To: <chris@xxxxxxxxxxxx>
Cc: <php-general@xxxxxxxxxxxxx>
Sent: Thursday, June 21, 2007 4:03 AM
Subject: Re: POST adding extra characters
chris@xxxxxxxxxxxx wrote:
Hi.. when using POSTon a text box to send info its adding an extra \
character.
<form action="script.php" method="POST">
<TEXTAREA NAME="save" COLS=100 ROWS=15>
dry-run:
filter: account-id = '10002'
select: key
</textarea>
<P><br><INPUT TYPE="submit" VALUE="submit">
</FORM></a>
That information is then written to a text file with..
$msg = $ud_save;
$f = fopen("file.txt", 'w');
fwrite($f, $msg);
fclose($f);
Whats written to the text file should be..
dry-run:
filter: account-id = '10002'
select: key
but its writting this instead..
dry-run:
filter: account-id = \'10002\'
select: key
How can I stop it addind the backslashes \
Thanks
Chris
sounds like you have magic quotes enabled.
something like this at the top of you script will fix the problem.
if ( get_magic_quotes_gpc() ) {
$_GET = array_map("stripslashes", $_GET);
$_POST = array_map("stripslashes", $_POST);
$_REQUEST = array_map("stripslashes", $_REQUEST);
}
--
Jim Lucas
"Some men are born to greatness, some achieve greatness,
and some have greatness thrust upon them."
Twelfth Night, Act II, Scene V
by William Shakespeare
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
The question I have for you now is, do you understand what that code
snippet does?
Jim Lucas
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php