Edit and Delete button Implementation #

show.php

<table class="table table-striped table-borderrer">
    <tr>
        <th>ID#</th>
        <th>Name</th>
        <th>Price</th>
        <th>Description</th>
        <th>Actions</th>
    </tr>

    <?php
        if($result->num_rows > 0 ){
            while($row = $result->fetch_assoc()){
                echo "<tr>";
                echo "<td>" . $row['id'] . "</td>";
                echo "<td>" . $row['name'] . "</td>";
                echo "<td> Rs. " . $row['price'] . "</td>";
                echo "<td>" . $row['description'] . "</td>";
                echo "<td>";
                echo "<div class='btn-group'>";
                echo "<a class='btn btn-secondary' href='./update.php?id=" .$row['id'] ."'> Update </a>";
                echo "<a class='btn btn-danger' href='./delete.php?id=" .$row['id'] ."'> Delete</a>";
                echo "</div>";
                echo "</td>";
                echo "</tr>";
            }
        }
    ?>
</table>

comments powered by Disqus