Re: stripslashes()

From: Date: Sun, 02 Mar 2003 01:20:44 +0000
Subject: Re: stripslashes()
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-137737@lists.php.net to get a copy of this message
At 02:05 02.03.2003, Dade Register said: --------------------[snip]-------------------- >Well, only diff is it's a POST from a textarea. With >magicquotes on, you're right, it makes "Thank's" >become "Thank\'s". how can I get rid of that? I'm >posting it to a text file. --------------------[snip]-------------------- Use stripslashes(). Try this example: <?php $var = $_REQUEST['blah']; echo '<xmp>$REQUEST[\'blah\']: "', $var, "\"\n"; $var = stripslashes($var); echo 'stripslashe\'d: "', $var, '"</xmp>'; echo '<form method="post">', '<textarea name="blah">', $var, '</textarea><br />', '<input type="submit"></form>'; ?> You will notice the textarea transmits "Thank\'s" which is displayed in the first line, and stripslashes() removes the backslash and displays "Thank's". Note that you also must use the stripslashe'd data when constructing the textarea. -- >O Ernest E. Vogelsinger (\) ICQ #13394035 ^ http://www.vogelsinger.at/

« previous php.general (#137737) next »