提交后不显示选中的行

Not show checked rows after submit

我有一个带有复选框和提交按钮的 table。当我 select 一些行并单击提交按钮时,这会给我一个 xml 报告。我希望我之前 select 编辑的行在我再次看到 table 时不再显示。我不想在数据库中删除它们,我只是希望它们不再显示。有没有办法在 PHP 或 javascrypt 中做到这一点?

更新: 那是我的 table:

    <form action="companies.php" method="post" onsubmit='checkform()'>
            <table border=2 style="width:1200px";>                
    <tr>
                        <td class="ttd"><input type="checkbox" value="<?php echo $ff['ID']; ?>" name="chk[]"> </td>
                        <td class="ttd"><?php echo htmlentities($ff['ID']); ?> </td>
                        <td class="ttd"><?php echo htmlentities($ff['Invoice_number']); ?> 
                        <input type="hidden" name="Inum[<?php echo $ff['ID']; ?>]" value="<?php echo $ff['Invoice_number']; ?>"></td>
                        <td class="ttd"><?php echo htmlentities($ff['Invoice_date']); ?> </td>
                        <td class="ttd"><?php echo htmlentities($ff['Month']); ?> </td>
                        <td class="ttd"><?php echo htmlentities($ff['Space_name']); ?> 
                        <input type="hidden" name="Sname[<?php echo $ff['ID']; ?>]" value="<?php echo $ff['Space_name']; ?>"></td>
                        <td class="ttd"><?php echo htmlentities($ff['Company_name']); ?> 
                        <input type="hidden" name="Cname[<?php echo $kunde['ID']; ?>]" value="<?php echo $ff['Company_name']; ?>"></td>
                        <td class="ttd"><?php echo htmlentities($ff['Amount']); ?> 
                        <input type="hidden" name="amount[<?php echo $ff['ID']; ?>]" value="<?php echo $ff['Amount']; ?>"></td>
                        <td class="ttd" style="width:200px;"><?php echo htmlentities($x); ?> 
                        <input type="hidden" name="iban[<?php echo $ff['ID']; ?>]" value="<?php echo $ff['Iban']; ?>"></td>
                        <td class="ttd"><?php echo htmlentities($ff['BIC']); ?> 
                        <input type="hidden" name="bic[<?php echo $ff['ID']; ?>]" value="<?php echo $ff['BIC']; ?>"></td>
                    </tr>
    </table>
            <button type="submit" name="submit" value="submit" onclick='sendit()'>submit</button>
</form>

更新2: 脚本:

document.forms[0].addEventListener("submit", function(event){
        if ( send == 0 ) { event.preventDefault(); }
    });
    
function myFunction(el) {
  var hidden = el.previousElementSibling;
  hidden.style.display = 'block';
  hidden.select();
  hidden.setSelectionRange(0, 99999)
  document.execCommand("copy");
  alert("Copied the text: " + hidden.value);
  hidden.style.display = 'none';
}
  
var send = 0;

function sendit(){
      send = 1;
     console.log(send);
  }
  
function checkform(){
    if (send == 1){
        console.log(send);
        document.form[0].submit();
    } else {
        return false;
    }

 }
  

和companies.php创建一个xml文件。

我必须在数据库中添加一个值为 null 的布尔列,当我单击提交时,将在 1 中进行更改,并且使用简单的 if 连接,我之前选择的行不再显示。 所以,这是 table:

<form action="companies.php" method="post" onsubmit='checkform()'>
        <table border=2 style="width:1200px";>
    <?php
     if($ff['checkbox'] == 0){
              
    ?>
                
                <tr>
                    <td class="ttd"><input type="checkbox" value="<?php echo $ff['ID']; ?>" name="chk[]"> </td>
                    <td class="ttd"><?php echo htmlentities($ff['ID']); ?> </td>
                    <td class="ttd"><?php echo htmlentities($ff['Invoice_number']); ?> 
                    <input type="hidden" name="Inum[<?php echo $ff['ID']; ?>]" value="<?php echo $ff['Invoice_number']; ?>"></td>
                    <td class="ttd"><?php echo htmlentities($ff['Invoice_date']); ?> </td>
                    <td class="ttd"><?php echo htmlentities($ff['Month']); ?> </td>
                    <td class="ttd"><?php echo htmlentities($ff['Space_name']); ?> 
                    <input type="hidden" name="Sname[<?php echo $ff['ID']; ?>]" value="<?php echo $ff['Space_name']; ?>"></td>
                    <td class="ttd"><?php echo htmlentities($ff['Company_Name']); ?> 
                    <input type="hidden" name="Cname[<?php echo $ff['ID']; ?>]" value="<?php echo $ff['Company_Name']; ?>"></td>
                    <td class="ttd"><?php echo htmlentities($ff['Amount']); ?> 
                    <input type="hidden" name="amount[<?php echo $ff['ID']; ?>]" value="<?php echo $ff['Amount']; ?>"></td>
                    <td class="ttd" style="width:200px;"><?php echo htmlentities($x); ?> 
                    <input type="hidden" name="iban[<?php echo $ff['ID']; ?>]" value="<?php echo $ff['Iban']; ?>"></td>
                    <td class="ttd"><?php echo htmlentities($ff['BIC']); ?> 
                    <input type="hidden" name="bic[<?php echo $kunde['ID']; ?>]" value="<?php echo $kunde['BIC']; ?>"></td>
                </tr>
</table>
        <button type="submit" name="submit" value="submit" onclick='sendit()'>submit</button>
        </form>

并在 companies.php 保存 xml 文件之前添加此查询:

if ($_POST['submit']){
#### XML file create  
####..... at the End, when all xml attribute to be created ######
$query = "UPDATE ff SET checkbox = 1 WHERE Invoice_number = '{$invoice_number}'";
            $result = mysqli_query($connection, $query);
         
         
         if($result && mysqli_affected_rows($connection)>= 0){
            $xml->formatOutput = true;
            $xml->save('../includes/xml/'.$filename) or die('XML Create Error') ;
            redirect_to("manage_content.php");
    }