Jump to content

need to finish php code to fill DB


madcrazy1

Recommended Posts

<?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

Link to comment
https://forums.phpfreaks.com/topic/247166-need-to-finish-php-code-to-fill-db/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.