Detele from DB with button [closed]

I want to delete info by click a button. So from select menu when i chose number from 1- 20 and push button NEXT is shows me “all the orders in that table from DB” When I push the button Finish in theory should delete all orders on the table i choose in DB. When i push the buutton it give me sql error.PLS help.

<?php
    require_once("connect.php");
    echo '<pre>'; print_r($_POST); echo '</pre>';
    
    if (isset($_POST['buton']))
    {   
        $tablenumber=$_POST['number'];
        $sql="SELECT orders.code,menu.name,orders.count,menu.price, orders.count*menu.price as Total 
        FROM orders,menu WHERE table_number=$tablenumber and orders.code=menu.code";    
        $quer=mysqli_query($conn,$sql)or die ('error sql');
        $num=mysqli_num_rows($quer);

        $sql2="SELECT  SUM(orders.count*menu.price) as TotalPrice 
        FROM orders,menu WHERE table_number=$tablenumber and orders.code=menu.code";    
        $quer2=mysqli_query($conn,$sql2)or die ('error sql2');      
    }
        if (isset($_POST['Finish']))    
        {   
            $tablenumber=$_POST['number'];
    
        $sql3=" DELETE FROM orders WHERE table_number=$tablenumber";
        $quer3=mysqli_query($conn,$sql3)or die ('error 1sql');
        }
    
?>
<html>
<form action="login.php" method="post">
<span style="display:flex; justify-content:flex-end; width:100%; padding:0;">
    <input type="submit" value="Exit"/>
</form>
</span>
        <style>
            body {background-color: #87CEEB;}
        </style>
    <head>
        <title>Factura</title>
        <!---<meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <link rel="stylesheet" href="dff.css"/>  !--->
    </head>
    <body>  
        <form id="frmFactura" action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="POST">
                
           <div id="cabeceraFactura">
                <br>
                <SELECT NAME="number" size="1">
                    <option value="---">---</option>
                    <?php
                        for($i=1;$i<=20;$i++)
                        { echo "<option value=".$i.">".$i."</option>";}
                    ?>
                </SELECT>               
                <input type='submit' name='buton' value="NEXT"/>    
            </div>
            <br>
            <table id ="detalle" border="2" width="3" cellspacing="2" cellpadding="1">
                <thead>
                    <tr>
                     <th>Name</th>
                        <th>Count</th>
                        <th>Unit price</th>
                        <th>Total</th>
                    </tr>
                </thead>
                <tbody>
                <?php
                
                    if(isset($_POST['buton']))
                    {    while ($resul=mysqli_fetch_array($quer) )  
                        {   echo '
                    <tr>
                        <td><input class="descrip" type="text" name="naimenovanie" value="'.$resul["name"].'" disabled=""/></td>
                        <td><input class="cant" type="text" name="kolichestvo"  value="'.$resul["count"].'" disabled=""/></td>
                        <td><input class="vunit"type="text"  name="cena" value="'.$resul["price"].'" disabled=""/></td>
                        <td><input class="totPro" type="text"  name="obstho" value="'.$resul["Total"].'" disabled=""/></td>     
                    </tr>
                        ';
                        }
                    }       
                ?>
                </tbody>
            </table> 
            <br>
            <div class="Resultados">
                <table border="2" width="3" cellspacing="2" cellpadding="1">                  
                    <tr>
                        <td><label id="lbl">TotalPrice</label></td>
                        <?php
                            if(isset($_POST['buton'])) $resul2=mysqli_fetch_array($quer2);
                        ?>
                        <td><input class="totPro" type ="text" value="<?php if(isset($_POST['buton'])) 
                         echo $resul2['TotalPrice'];?>"  disabled=""/> </td>
                     
                    </tr>   
                </table>
                <br>
                <button onclick="window.print()" width="200">Print </button>    
                    <input type="submit"  name= "Finish" value = "Finish">
            </div>  
        </form>                                         
    </body>
</html>