2
I am working on a simple application that reads XML files, I take the data I do the processing and then I show on the screen the data I want from XML, all via I am showing in a table and the header is if suddenly due is inside the foreache, if I take the foreach table does not show the data, someone knows how to show only the header and only the data repeat ?
I will leave the image of how the table is shown and a part of the code
<?php
error_reporting(0);
ini_set(“display_errors”, 0 );
//Instanciando o OBJ
$xml = new DOMdocument();
//Pegando o TMP do FORM
$arquivo = $_FILES['entXML']['tmp_name'];
    //Total de todos os XML
      $totArquivos = 0;
      $arquivos = $arquivo;
//Navegando no Nodes(Nós)
foreach( $arquivos as$arquivos){
 //Carregando o XML
 $xml ->load($arquivos) or die(" ");
  //Entra dentro do NÓ pai do XML
  $arquivos = $xml->getElementsByTagName( "nfeProc" );
    //Pega Nome
      $nomes = $xml->getElementsByTagName( "xNome" );
      $nome = $nomes->item(0)->nodeValue;
    //Pega CNPJ
      $cnpjS = $xml->getElementsByTagName( "CNPJ" );
      $cnpj = $cnpjS->item(0)->nodeValue;
    //Mostra dados do Emitente
      echo"<header class='text-center'>";
          echo"<div class='col-sm-6 Dempresa'><b>Empresa(Razão):</b> <p>$nome</p></div>";
          echo"<div class='col-sm-4 Dempresa'><b>Cnpj:</b> <p>$cnpj</p></div>";
      echo"</header>";     
        break;  
        }  
          //RECURSO DESESPERADO02 kk
          $arquivo = $arquivo;
//RODANDO TODOS OS ENDEREÇOS DOS ARQUIVOS
for($i = 0; $i < count($arquivo);$i++ ){
        $totArquivos +=count($arquivo); //Total dos arquivos Carregados  
    //Entra dentro do NODE "ide"
foreach( $arquivo as $arquivo[$i]){        
          //Carregando o XML
        $xml ->load($arquivo[$i]) or die(" ");
          //Entra dentro do NÓ pai do XML
        $arquivo[$i] = $xml->getElementsByTagName( "nfeProc" );
  //Pega Data de Emissão da NF
      $chaveS = $xml->getElementsByTagName("infNFe");
      $chave =  $chaveS->item(0)->getAttribute("Id");
  //Pega Data de Emissão da NF                            
      $dataEMS = $xml->getElementsByTagName( "dhEmi" );
      $dataEmi = $dataEMS->item(0)->nodeValue;
  //Pega CFOP                           
      $cfopS = $xml->getElementsByTagName( "CFOP" );
      $cfop = $cfopS->item(0)->nodeValue;
  //Pega Modelo                                    
      $modeloS= $xml->getElementsByTagName( "mod" );
      $modelo = $modeloS->item(0)->nodeValue;
//Mostra Tabela na Tela
      echo "<table  class='table table-striped  table-bordered table-hover table-sm'>";          
              echo"<thead class='thead-light'>";
                echo "<tr>";
                  echo "<th scope='row'>CHAVE DE ACESSO</th>" ;
                  echo "<th class='text-center meu'>Data Emissão</th>" ;
                  echo "<th class='text-center'>CFOP</th>" ;
                  echo "<th>Valor</th>" ;
                  echo "<th>Modelo</th>" ;
                  echo "<th>Status</th>" ;
                echo "</tr>";
          echo'</thead>';
          echo"<tr>";
              echo"<td>$chave</td>";
              echo"<td class='text-center'>".date('d/m/y',strtotime($dataEmi))."</td>";//formato de data brasileiro
              echo"<td class='text-center'>$cfop</td>";
              echo"<td>".number_format($vaPag, 2)."</td>";//Formato moeda com 2 casas(Americano)
              echo"<td  class='text-center'><b>$modelo<b> </td>";
              echo"<td>$motivo </td>";                  
          echo"</tr>";     
      echo "</table>";

Good morning Mr: Augusto Vasques Raca picking up his logic of explanation became easy to understand, Thank you worked perfectly here. God Bless, I’ll hug le follow on social networks kkk
– Gabriel Francisco Santana Sant
I almost no longer use social network. After Facebook banned my pages I was disappointed. I have a Tweeter account but I don’t use it.
– Augusto Vasques
Good Morning Right Looking for the Face really did not find tbm n use Tweeter, but anyway Thanks --> Linkedin: https://www.linkedin.com/in/gabriel-santos-498
– Gabriel Francisco Santana Sant
Augusto Goodnight, You can help me with this question I’ve tried anyway here and nothing.... https://answall.com/questions/401608/pular-uma-itera%C3%A7%C3%A3o-com-foreach-when-found-error-no-file-php
– Gabriel Francisco Santana Sant