title: How to pull a specific tag from a node in xml with PHP?
body: <p>Here is where I set up basic variables, such as creating the new DomDoc and such as well as loading some of the Tags. This all works fine at the moment.</p>
  
  <pre><code>  &lt;?php 
  if (isset($_GET['edit'])&amp;&amp; $_GET['edit']=='delete' &amp;&amp; isset($_GET['id'])&amp;&amp;!empty($_GET['id'])){
          $dom = new DomDocument();
          $dom-&gt;preserveWhiteSpace = false;  
          $dom-&gt;load("data.xml");
          $root = $dom-&gt;documentElement;
          $record = $root-&gt;getElementsByTagName("data");
          $ID=$root-&gt;getElementsByTagName("ID");
          $nodetoremove = null;
          //$namenode=$root-&gt;getElementsByTagName("own_name");
          //$name="";
          //$datenode=$root-&gt;getElementsByTagName("sign_in");
          //$date="";
          $newid=$_GET['id'];
          foreach($ID as $node){
  
          $pid =$node-&gt;textContent;
  </code></pre>
  
  <p>Here I am checking if it's a new ID and if it is it does the following as seen. </p>
  
  <pre><code>    if ($pid == $newid) 
              { 
  $nodetoremove=$node-&gt;parentNode;
  
              } 
  
      }
  </code></pre>
  
  <p>The issue is here. I am able to go through the selected node I wish to delete ($nodetoremove) and select a specific element (sign_in) but I am unsure how to so. Right now all I can do is go through and print all of the elements within the nodes of $nodetoremove. Is there a way I can get the element I want from XML this way?</p>
  
  <pre><code>    //Prints all information within $nodetoremove
          foreach ($nodetoremove-&gt;childNodes AS $item){
          print $item-&gt;nodeName . "=" . $item-&gt;nodeValue . "&lt;br&gt;";
          }
      foreach ($nodetoremove as $node) {
   }
      //Sets $name to the first Child of $nodetoremove
      $name=$nodetoremove-&gt;firstChild-&gt;nodeValue;
  
  
      //Checks if the nods to remove is not null, if it is removes $nodetoremove
      if($nodetoremove!=null){
          $root-&gt;removeChild($nodetoremove);
  ?&gt;
  </code></pre>