mardi 9 novembre 2021

foreach checkpoint not work in xml report

I have a normal form with checkbox:

<td class="ttd"><input type="checkbox" value="<?php echo htmlentities($kunde['ID']); ?>" name="chk[]"> </td>
<td class="ttd"><?php echo htmlentities($kunde['ID']); ?> </td>
<td class="ttd"><?php echo htmlentities($kunde['Invoice_number']); ?> </td>

I try to have a xml report for every checked row. that is a loop part in my code:

foreach($_POST['chk'] as $key => $value){
    if($_POST['chk'][$key]==$kunde["ID"]){
         $CdtTrfTxInf = $xml->createElement('CdtTrfTxInf' . $i);
         $PmtInf->appendChild($CdtTrfTxInf);
         $EndToEndId = $xml->createElement('EndToEndId', $Invoice_number);
         $PmtId = $xml->createElement('PmtId');
         ...
    }
    $xml->formatOutput = true;
    $xml->save('../includes/xml/'.$filename) or die('XML Create Error') ;
    redirect_to("manage_content.php");
}

when i test it, with echo, that gives me every column und row, that i selected. but when i want to create a xml report, that gives me just first row. anyone can help me?




Aucun commentaire:

Enregistrer un commentaire