I already create a delete button, but when I click it no showing any error message and the cart item and the item in database no get deleted.
<td class="col-sm-1 col-md-1">
    <button type="button" class="btn btn-sm btn-danger delete_cart_btn" value="<?= $citem['prod_id']; ?>">Delete</button>
</td>
This is the delete button function
if(isset($_POST['delete_cart_btn']))
{
    $prod_id = mysqli_real_escape_string($con, $_POST['prod_id']);
    $prod_query = "SELECT * FROM carts WHERE id='$prod_id' ";
    $prod_query_run = mysqli_query($con, $prod_query);
    $prod_data = mysqli_fetch_array($prod_query_run);
    $image = $prod_data['image'];
    $delete_query = "DELETE FROM carts WHERE id='$prod_id' ";
    $delete_query_run = mysqli_query($con, $delete_query);
    if($delete_query_run)
    {
         if(file_exists("../assets/images/products/".$image))
         {
             unlink("../assets/images/products/".$image);
         }
         echo 200;
    }
    else
    {
         echo 404;
    }
 }
Here my database enter image description here
Here the button cart script and the button function
enter image description here enter image description here
Here the full code the cart
<div id="fullCart" class="row">
    <div class="col-sm-12 col-md-12 col-md-offset-1">
        <table class="table table-hover">
            <thead colspan="4">
            <tr>
                <p class="text-center"><strong><span style="font-size: 25px;"><i class="fa fa-shopping-cart" style="font-size:25px;color:black"></i> My Cart</span></strong></p>
            </tr>
            </thead>
            <hr>
            <thead>
            <tr>
                <th class="text-center">Product</th>
                <th class="text-center">Quantity</th>
                <th class="text-center">Price</th>
                <th class="text-center">Total</th>
                <th>Action</th>
            </tr>
            </thead>
            <tbody>
                <?php 
                    $subTotal   = 0;
                    $quantity   = 0;
                    $tax        = 10;
                    $items = getCartItems();
                    foreach ($items as $citem) {
                      $subTotal += $citem['prod_qty'] * $citem['selling_price'];
                      $quantity += $citem['prod_qty'];
                ?>
                 
                <tr id="item_<?= $citem['prod_id']; ?>">
                <td class="col-sm-8 col-md-6">
                    <div class="media">
                        <img class="media-object" src="assets/images/products/<?= $citem['image']; ?>" style="width: 100px; height: 100px;">
                        <h4 class="media-heading" style="position:relative; left:110px; top:-100px;"><?= $citem['name']; ?></h4>
                    </div>
                </td>
                <td class="col-sm-1 col-md-1 text-center">
                    <strong><?= $citem['prod_qty']; ?></strong>
                </td>
                <td class="col-sm-1 col-md-1 text-center">
                    <strong><span style="font-size: 18px;">$</span><span id="price"><?= number_format( $citem['selling_price'], 2 ); ?></span>
                    </strong>
                </td>
                <td class="col-sm-1 col-md-1 text-center">
                    <strong><span style="font-size: 18px;">$</span><span id="totalPrice_<?= $citem['prod_id']; ?>"><?= number_format( $citem['prod_qty'] * $citem['selling_price'], 2 ); ?></span>
                    </strong>
                </td>
                <td class="col-sm-1 col-md-1">
                    <button type="button" class="btn btn-sm btn-danger delete_cart_btn" name="delete_cart_btn" value="<?= $citem['prod_id']; ?>">Delete</button>
                </td>
            </tr>
            <?php } ?>
            <tr>
                <td colspan="4" align="right">Subtotal</td>
                <td class="text-right">
                    <strong><span style="font-size: 18px;">$</span>
                        <span id="subTotal"><?= number_format( $subTotal, 2 ); ?></span>
                    </strong>
                </td>
            </tr>
            <tr>
                <td colspan="4" align="right">Taxes</td>
                <td class="text-right">
                    <strong><span style="font-size: 18px;">$</span>
                        <span id="taxes"><?= number_format( $tax * $quantity, 2 ); ?></span>
                    </strong>
                </td>
            </tr>
            <tr>
                <td colspan="4" align="right">Total</td>
                <td class="text-right">
                    <strong><span style="font-size: 18px;">$</span>
                        <span id="finalPrice"><?= number_format( $subTotal+($tax * $quantity), 2 ); ?></span>
                    </strong>
                </td>
            </tr>
            <tr>
                <td colspan="4" align="right">
                    <a href="index.php" class="btn btn-default">
                        <span class="glyphicon glyphicon-shopping-cart"></span> Place Order
                    </a>
                </td>
                <td >
                    <a href="checkout.php" class="btn btn-success">
                        Order <span class="glyphicon glyphicon-play"></span>
                    </a>
                </td>
            </tr>
            </tbody>
        </table>
    </div>
</div>
 
     
    