BlooMort BlooMort - 20 days ago 6
PHP Question

Form post replaces " (double quotes) with "

I have developed on a local server. When I upload the pages to the website then I get this problem. It does not occur on my local server (WAMP).

<form class='form-horizontal' method='post' id='uparticle'>

...

<textarea class='form-control <?php echo $cked ?>' name='editor1' id='editor1' rows='10' cols='80'>
<?php echo $article; ?>
</textarea>


When I submit the form it replaces
"
with
\&quot;
. I have used ckeditor but it is not that, as I have also sent the $article in a textdata field without using ckeditor.

I have also eliminated the database write by displaying the textdata before it is written to the database.

For example:
<table border="1" cellpadding="2" cellspacing="0">
gets rewritten as
<table border="\&quot;1\&quot;" cellpadding="\&quot;2\&quot;" cellspacing="\&quot;0\&quot;">


I think it is probably some configuration setting, but I have no idea where to look.

Answer

This may probably be caused by magic_quotes_gpc setting if you're using an old PHP version (i.e., 5.3). Check the settings in your php.ini and set its value to "0". Check other magic_quotes settings as well, you may turn them off also.

For more information please look http://php.net/manual/en/info.configuration.php#ini.magic-quotes-gpc