Re: POST adding extra characters

From: Date: Thu, 21 Jun 2007 03:15:17 +0000
Subject: Re: POST adding extra characters
References: 1 2 3  Groups: php.general 
Request: Send a blank email to php-general+get-257532@lists.php.net to get a copy of this message
Thanks Jim worked a treat ----- Original Message ----- From: "Jim Lucas" <lists@cmsws.com> To: <chris@aquanuke.com> Cc: <php-general@lists.php.net> Sent: Thursday, June 21, 2007 4:03 AM Subject: Re: [PHP] POST adding extra characters
chris@aquanuke.com 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


« previous php.general (#257532) next »