i73 Posted May 17, 2014 Share Posted May 17, 2014 Hey guys I am Posting data over to a server file in Json and I need to know how I can add to the XML file. here is both codes. function validate() { $xml = simplexml_load_file("stock.xml"); $sxe = new SimpleXMLElement($xml->asXML()); for($i = 1; $i < 801; $i++) { $newItem->addChild("name" , "null"); } $sxe->asXML("stock.xml"); echo $sxe->asXML(); $response = $_POST; $response["items"] = "Test output"; $response["description"] = "test 42 "; $response["json"] = json_encode($response); echo json_encode($response); } The red text is what I want this json script to do. Do I have to return back to my form to add to the XML file? Can json add to a xml file on its own? Thanks for your time! have a good day! Link to comment https://forums.phpfreaks.com/topic/288563-xml-and-json/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.