I've read some threads already on this subject and it appears that some clarification is still needed.

Before I continue I first want to say, "Yes, this was part of a school assignment, No, I'm not cheating, I've already turned it in and I'm awaiting a grade."
I just want clarification to what I don't understand. When I asked my instructor she redirected me to a student who was successful, even though I've tried to repeat his
steps, the code doesn't work for me. The knowledge I expect my instructor to possess doesn't appear to be within reach and I have no other contact with the successful student,
so, I came here.

First, let me say, a box or a redirection to another page is fine, I was actually attempting a redirection, the successful student also did a redirection.
I will also be providing several codes, samples of working code, sample attempts of non-working code.

Second, I don't want any JS code, this code should work in PHP only.

I also want to give a shout out to ginerjim and priyankagound for their successful JS Script posts. I've tried both and they both function beautifully.

There are three pages involved, index.php, product_list.php, and confirm.php

The code below works, it'll delete from the database, it does not provide any confirmation of the delete.

From index.php


Code:
include('product_list.php');
} else if ($action == 'delete_product') {
// Get the IDs
$product_id = $_POST['product_id'];
$category_id = $_POST['category_id'];
    
// Delete the product
delete_product($product_id);

// Display the Product List page for the current category
header("Location: .?category_id=$category_id");
}
From product_list.php

Code:
<form action="." method="post">
<input type="hidden" name="action"
value="delete_product" /> 
<input type="hidden" name="product_id"
value="<?php echo $product['productID']; ?>" />
<input type="hidden" name="category_id"
value="<?php echo $product['categoryID']; ?>" />
<input type="submit" value="Delete" />
</form>
Next is attempted code:
This is a sample of what worked for the successful student.
From index.php


Code:
include('product_list.php');
} else if ($action == 'delete_product') {
// Get the IDs
$product_id = $_POST['product_id'];
$category_id = $_POST['category_id'];
include('confirm.php');    
    
} else if ($action == 'YES') {
// Get the IDs
$product_id = $_POST['product_id'];
$category_id = $_POST['category_id'];
    
// Delete the product
delete_product($product_id);

// Display the Product List page for the current category
header("Location: .?category_id=$category_id");
}
From product_list.php

Code:
<form action="." method="post">
<input type="hidden" name="action"
value="delete_product" /> 
<input type="hidden" name="product_id"
value="<?php echo $product['productID']; ?>" />
<input type="hidden" name="category_id"
value="<?php echo $product['categoryID']; ?>" />
<input type="submit" value="Delete" />
</form>
From confirm.php

Code:
<form action="." method="post">
<input type="hidden" name="action"
value="YES" /> 
<input type="hidden" name="product_id"
value="<?php echo $product['productID']; ?>" />
<input type="hidden" name="category_id"
value="<?php echo $product['categoryID']; ?>" />
<input type="submit" value="YES" />
</form>
As you can see, he didn't change much. What happens with this particular version I get a fetch() error.
I've tried other variations of this same code and received some other coding error or another with no idea as to why I can't get this to work.
In theory it all looks correct, but apparently, something is amiss.

If anyone can stare at my code and provide suggestions, it would be greatly appreciated.