If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

[RESOLVED] PHP Confirm on Delete Confusion

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.

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.

Real quick! The attempted code does redirect to the confirm.php. I also want to mention some errors I've had other than fetch() . . .
It doesn't redirect back to the product_list.php, it redirects to the folder with no page, doesn't even list from index.php, this error is with this code:

Code:

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

Of course, the confusion is . . "Why is it suddenly broken?" . . . It can't call the category id.

Other errors include . . . not leaving the confirm.php page and not deleting. Any other errors I can't remember at the moment.

"Works" for me means I got a delete button, once pressed I got a button with "Yes" as well.
Clicking "Yes" runs the delete_product function and does a redirection to http://www/?category_id=99, on my webserver.

"Works" for me means I got a delete button, once pressed I got a button with "Yes" as well.
Clicking "Yes" runs the delete_product function and does a redirection to http://www/?category_id=99, on my webserver.

For whatever reason this only "breaks" when I try to make the confirm page. Otherwise, everything works just fine. I honestly don't see why creating a new page in the same folder as the other pages, that operate as should, would cause the problem.

Oh. Okay, well, I understood it when I read it. I'm going to give you the page as it currently works. Poke around if you want . . . adding/deleting, etc. There will be no confirmation, but at least you can see what is going on and maybe come up with some ideas. I don't know if I should post it here, so I'm just going to send you a private message with the link, but please post your response here so that others can benefit if we find a solution.