php auto add \ to href
<p>I have this problem with my webpage when i hit the "edit" button, all href adds "\" to the links.</p>

<p>It would keep adding on as the button is hit.</p>

<p>I tested it on xampp-localhost but everything is normal - it only happen when it is hosted. </p>

<p>I am new to php ;I tried to google it,but don't know where to look at, the code below is my edit button's action:</p>

<pre><code>if ($img_path!=NULL){
        //delete old image  
        $sql="SELECT image FROM entry WHERE url =?";
        $stm = $db-&gt;prepare($sql);
        $stm-&gt;execute(array($_POST['url']));
        $e = $stm-&gt;fetch();
        if($e['image']!="/simple_blog/img/no_img.jpg"){
            unlink($_SERVER['DOCUMENT_ROOT'].$e['image']);
        }

        //update new contain
        $sql = "UPDATE entry SET entry=?, title=?, image=?, url=? WHERE url = ?";
        $stmt = $db-&gt;prepare($sql);
        $stmt-&gt;execute(array($_POST['wall'],$_POST['title'],$img_path,$url,$_POST['url']));
    } elseif ($img_path==NULL){
        $sql = "UPDATE entry SET entry=?, title=?,url=? WHERE url = ?";
        $stmt = $db-&gt;prepare($sql);
        $stmt-&gt;execute(array($_POST['wall'],$_POST['title'],$url,$_POST['url']));
    }
    $stmt-&gt;closeCursor();
    header('Location: /simple_blog/blog/'.$_POST['url']);
</code></pre>

<p>sorry if I am not explain well about the problem, here is the page you can have a look at, I put the problem in first entry.</p>

<p><a href="http://tblog.comli.com/simple_blog/" rel="nofollow">Link  To Blog</a></p>

<p>user: testUser</p>

<p>pass: 12345</p>

<p>Thank you very much for any help!</p>

<p>Thank you PleaseStand for the suggestion link :D it's Magic quotes</p>

<p>Just need to add the following code and everything would work fine:</p>

<pre><code>&lt;?php
if (get_magic_quotes_gpc()) {
$process = array(&amp;$_GET, &amp;$_POST, &amp;$_COOKIE, &amp;$_REQUEST);
while (list($key, $val) = each($process)) {
foreach ($val as $k =&gt; $v) {
    unset($process[$key][$k]);
    if (is_array($v)) {
        $process[$key][stripslashes($k)] = $v;
        $process[] = &amp;$process[$key][stripslashes($k)];
    } else {
        $process[$key][stripslashes($k)] = stripslashes($v);
    }
}
}
unset($process);
}?&gt;
</code></pre>
