const editTablebtn=document.querySelectorAll('.editTablebtn');
editTablebtn.forEach(btn=>{
    btn.addEventListener('click',()=>{
        document.getElementById('editTableid').value=btn.dataset.id;
        document.getElementById('editTablename').value=btn.dataset.table;
     
    })
})
document.querySelectorAll(".table-delete-btn").forEach(btn=>{
    btn.addEventListener("click",()=>{
        if(confirm("Are you sure you want to delete this table?")){
            const Id=btn.dataset.id;
        fetch("../pages/submissions/tablesSubmission.php",{
            method:"POST",
            headers:{"Content-Type":"application/x-www-form-urlencoded"},
            body:"ID="+Id
        })
        .then(res=>{res.text()})
        .then((data)=>{
            location.reload()
        })
    }
})
})