1.when I started searching by date in the upper left corner I get absolutely all the displayed data? When I press the calculate button, all the information disappears?When I press the calculate button, only the tag remain? With the button SearchDate i Search date With the button “suma” i calculate the line.PLS HELP
require_once("connect.php");
if(isset($_POST['from_date']) && isset($_POST['to_date']))
{
        $from_date = $_POST['from_date'];
        $to_date = $_POST['to_date'];
        $sql="SELECT date, food_and_drinks, salary, insurance, gas, current, water, unexpected_expense FROM expense WHERE '$from_date' AND '$to_date'"; 
        $quer=mysqli_query($conn,$sql) or die ('error sql');
        while ($resul=mysqli_fetch_array($quer))
        {
            echo $resul['date'].$resul['food_and_drinks'].$resul['salary'].$resul['insurance'].$resul['gas'].$resul['current'].$resul['water'].$resul['unexpected_expense'];
        }
}
elseif(isset($_POST['sum']))
{
    $sql="SELECT  (expense.food_and_drinks+expense.salary+expense.insurance+expense.gas+expense.current+expense.water+expense.unexpected_expense) as Total 
    FROM expense "; 
    $quer2=mysqli_query($conn,$sql2)or die ('error sql2');
}
else
{   
    $sql="SELECT expense.date, food_and_drinks, salary, insurance, gas, current, water, unexpected_expense FROM expense";
    $quer=mysqli_query($conn,$sql)or die ('error sql');     
}
    
?>
<html>
    <head
    </head>
    <body>
        <center>
            <form action="<?php echo $_SERVER["PHP_SELF"]; ?>" method="POST" >
            от<input type="date" name="from_date"  value="<?php if(isset($_POST['from_date'])){ echo $_POST['from_date']; } ?>"> до
                <input type="date" name="to_date"  value="<?php if(isset($_POST['to_date'])){ echo $_POST['to_date']; } ?>">
                <input type="submit" name="" value="SearchDate">
                <table border="1" width ="40%">
                <tr>
                    <th>date</TH><th>food</TH><th>salary</TH><th>insurance</TH><th>gas</TH><th>current</TH><th>water</TH> <th>unexpected_expense</TH><th>Total Price</TH><th>Delete</TH>
                </tr>
<?php
while ($resul=mysqli_fetch_array($quer))
    {?>
        <tr>
        <td><input type="date" name="date"  placeholder="yyyy/mm/dd" value="<?php echo $resul['date'];?>"></td>
                <td><input type="text" name="food_and_drinks"  value="<?php echo $resul['food_and_drinks'];?>"></td>
                <td><input type="text" name="salary"  value="<?php echo $resul['salary'];?>"></td>
                <td><input type="text" name="insurance"  value="<?php echo $resul['insurance']; ?>"></td>
                <td><input type="text" name="gas"  value="<?php echo $resul['gas']; ?>"></td>
                <td><input type="text" name="current"  value="<?php echo $resul['current']; ?>"></td>
                <td><input type="text" name="water"  value="<?php echo $resul['water']; ?>"></td>
                <td><input type="text" name="unexpected_expense"  value="<?php echo $resul['unexpected_expense']; ?>" ></td>    
                <td><input type='submit' name='sum' value="suma"/>
                <?php
                    if(isset($_POST['sum'])) $resul2=mysqli_fetch_array($quer2);
                ?>
                <input class="totPro" type ="text" value="<?php if(isset($_POST['sum'])) echo $resul2['Total'];?>"  disabled=""/> </td>
                <td><a href="delete2.php?food_and_drinks=<?php echo $resul["food_and_drinks"]; ?>">Delete</a></td>
            </tr>   
    <?php
    }
    ?>
</table>        
        
      
    




