I'm having some trouble trying to build a very simple inventory management system.
What I'm doing is showing the data from a database in a html table and in each row a create two buttons: one to edit and one to delete the item. The problem is that I'm not being able to call these buttons with the isset() function and I can't understand why. I've tried to create a specific function for these but still doesn't work. Anybody has any idea?
Here is the code:
P.S.: Don't mind small english erros or a lack of of brackets. I had to change the code a little bit.
 function searchTablet(){
    
      if(isset($_POST['btnSearchTablet'])){
            
            global $connection;
            $query="SELECT * FROM tablet";
            $run=mysqli_query($connection, $query);
            echo "<table class='table table-striped'>";
                echo "<thead>";
                    echo "<tr>";
                        echo "<th>ID</th>";
                        echo "<th>Brand</th>";
                        echo "<th>Model</th>";
                        echo "<th>Color</th>";
                        echo "<th>Price</th>";
                        echo "<th>Fabrication Date</th>";
                        echo "<th>Provider</th>";
                        echo "<th>Registration Date</th>";
                        echo "<th>Edit</th>";
                        echo "<th>Delete</th>";
                    echo "</tr>";
                echo "</thead>";  
                while($obj=mysqli_fetch_object($run)){
                    echo "<tr>";
                        echo "<td>$obj->id</td>";
                        echo "<td>$obj->idBrand</td>";
                        echo "<td>$obj->idModel</td>";
                        echo "<td>$obj->idColor</td>";
                        echo "<td>$obj->price</td>";
                        echo "<td>$obj->fabricationDate</td>";
                        echo "<td>$obj->idProvider</td>";
                        echo "<td>$obj->registrationDate</td>";
                        echo "<td><a href='resultTablet.php?btnEditTablet{$obj->id}'class='btn btn-primary' name='btnEditTablet'>Alterar</a></td>";
                        echo "<td><a href='resultTablet.php?btnDeleteTablet{$obj->id}' class='btn btn-danger' name='btnDeleteTablet'>Excluir</a></td>";
                    echo "</tr>";
                    if(isset($_POST["btnDeleteTablet{$obj->id}"])){   
                        $idTablet=$obj->id;
                        $delQuery="DELETE FROM tablet WHERE id='$idTablet'";
                        $delRun=mysqli_query($connection, $delQuery);
                        if($delRun){
                            echo "<div class='alert alert-success' role='alert'>Device was successfuly deleted.</div>";
                        }else{
                            echo "<div class='alert alert-danger' role='alert'>Error.</div>";
                        }    
                    }
}
                    
 
     
     
    