I'm trying to write a PHP code that connects and get data cells from mySQL and also create a delete button for each row as it's increming as in mySQL database.
Please help me to figure out what am I doing wrong?!!
[where my table name is "vf" and its structure is like that]
ID     Password1     Password2
[And where PHP variables I used is]
$Connect=mysqli_connect($host,$user,$Pass,$db);
$QueryVF = mysqli_query($Connect,'SELECT * from vf');
$ID =$_POST['ID'];
$DelVF = mysqli_query($Connect,'DELETE from vf where ID =$ID');
/* ALSO TRIED This:  $DelVF = mysqli_query($Connect,'TRUNCATE vf'); */
[MY HTML & PHP code]
       
<html>
    <body>             
        <form method="POST">
            <table border="1" class=".input">              <!--vf Table-->
                        <tr>
                                <th>ID</th>
                                <th>Password 1</th>
                                <th>Password 2</th>
                                <th>Drop data</th>
                        </tr>
                            <?php
                                while ( $row = mysqli_fetch_array($QueryVF)){
                                echo'<tr>';
                                    echo'<td>'.$row['ID'].'</td>';
                                    echo'<td>'.$row['Password1'].'</td>';
                                    echo'<td>'.$row['Password2'].'</td>';
                                    echo "<td><button type=\"submit\" name=\"Delete\" oneclick=\"$DelVF\">Drop Data</button></td>";
                                        if($_POST['Delete']){
                                            while ($DelVF = mysqli_query($Connect,"'DELETE from vf where ID =$ID'") )
                                            $DelVF;
                                            echo "VF table's row is successfully deleted";
                                                                }
                                    echo'</tr>';
                              }
                             ?>
                        </table>
        </form>
    </body>
</html>
 
    