I'm having problem with a php script that is stock data to xml file , and it's just simply not being executed. I get the same code i wrote it in the the output page (in the browser). I am quite sure this is a PHP setting problem because before I have changed the host server it was working fine. That is the codes :
<?php
$tag = $price ='ds';
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$tag = test_input($_POST["comdtyprice"]);
$price = test_input($_POST["comdtyprice"]);
}
$xml = simplexml_load_file("b.xml");
$child = $xml->prices[0]->addChild($tag);
$child->addAttribute("text",$price);
$xml->asXML("b.xml");
function test_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>
and the output:
the browser act with the codes as a string