View Full Version : Backslash shows up in textarea content save to file?
gorilla1
07-18-2002, 05:16 AM
I am eading from a text area and then writing that content to a file. When I then read that file and display its contents, any single quote character appears with a backslash in front of it, e.g., "don't" appears as "don\'t".
Does anyone know why this happens and what steps can be taken to pevent it?
G
firepages
07-18-2002, 12:27 PM
it happens as PHP automatically escapes any special chars (this annoys many people) although magic_quotes can be disabled in the php.ini they rarely are (and partially for good reasons) but you can alter that with ini_set() at runtime if you wish www.php.net/ini_set
easiest way around is, when you display the data, instead of
echo $string;
echo stripslashes($string);
gorilla1
07-18-2002, 04:29 PM
firepages,
Thanks. I stripslashed $HTTP_POST_VARS and that got the job done.
G
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.