madcrazy1 Posted September 15, 2011 Share Posted September 15, 2011 <?php $var=$_POST["fname"]; $xmlDoc = new DOMDocument(); $xmlDoc->loadXML($var); $root = $xmlDoc->documentElement; $elms = $root->getElementsByTagName("*"); foreach ($elms as $item) { // gets the name and the value of each $item $tag = $item->nodeName; $value = $item->nodeValue; // outputs the $tag and $value echo $tag. ' = '. $value . ''; I want to use the code above to get all the xml files parent and child names and values and get them into the database. is this going to work? thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/247166-need-to-finish-php-code-to-fill-db/ Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.