The form data is saved to a config file.
The problem comes when a user wants to use a backslash " \ ".
When I use stripslashes it removes the backslash.
Here is an example of what I am doing:
Code: Select all
//GET RID OF MAGIC QUOTES
if (get_magic_quotes_gpc()) {
$_POST = array_map('stripslashes', $_POST);
}
//GET POST DATA
if (isset($_POST['content'])){
$content=$_POST['content'];}
if (isset($_POST['content2'])){
$content2=$_POST['content2'];}
//TURN POST DATA INTO ARRAY
$config = array(
$content=>"$content",
$content2=>"$content2"
);
//ADDSLASHES
$config = array_map('addslashes', $config);
//WRITE CONFIG DATA TO CONFIG FILE.......
foreach //blablabla.......Code: Select all
<textarea name="content" cols="50" rows="5" id="content"><?php echo htmlentities(stripslashes($content));?>into the form only Hello, my name is "Ron" is returned. No backslash.
Any Ideas as to why this happens and someway to fix it?
Thanks
Ron