hello, iam new in xml.. so i have xml file in it data like <author> data goes here </author> Code (markup): i call the xml file by JS function, so now i want to put the data between the 'author' tags from the database with php...so how can i put php inside that .xml file please ??
hi, assuming that Your xml file looks like: <?xml version="1.0"?> <items> <author> data goes here </author> </items> Code (markup): then You can use SimpleXML php extension to do what You want as below: $xmlFile = 'data.xml'; $sxe = simplexml_load_file($xmlFile); $sxe->author[0] = 'new data'; file_put_contents($xmlFile, $sxe->asXML()); Code (markup): take a look here for more details: http://php.net/manual/en/book.simplexml.php