I constructed my xml file with javascript and I show it correctly with an alert like this :
<Voitures>
<voiture par1="4" par2="1" par3="0"/>
<voiture par1="3" par2="0" par3="0"/>
</Voitures>
But the problem is when I send it with ajax to a php file I obtain this result :
<Voitures>
<voiture par1=\"4\" par2=\"1\" par3=\"0\"/>
<voiture par1=\"3\" par2=\"0\" par3=\"0\"/>
</Voitures>
Thank you
Your PHP configuration has magic quotes enabled, which is a deprecated setting that nobody should be using anymore. It has been removed in PHP 5.4. Disable it now, or you risk writing code that will behave incorrectly when you upgrade to PHP 5.4.
If that’s not possible, use
stripslashes()on the value prior to doing anything else with it. Only do this if you really cannot disable magic quotes. Developing PHP software with magic quotes enabled is a very, very bad idea.If you’re trying to write good code and be future-proof, put this as the top of every file, or some common include file that gets used everywhere:
This will make your application simply refuse to run if magic quotes are enabled.
If you have the option, ship a
.htaccessfile with your application that contains this:This will, if possible, disable magic quotes for your entire application when it is depolyed on Apache. If the Apache configuration does not permit
php_flagdirectives in.htaccessfiles then this will cause an HTTP 500 error, which is miles better than letting your application run with magic quotes enabled.