I am an experienced .NET programmer learning PHP. The project I'm working on is a pizza shop menu where the user can create a custom pizza & add it to the cart.
When the user clicks the Add to Cart button, which is on the menu page, the add_item function is called & one new item is added to the cart. The user is redirected to the cart page, using the include function.
At this point, if the user reloads the page (F5), the quantity of the item is increased by one. The browsers even warn about this. I've searched the Internet & I believe the header function is the solution, but I don't know where to place it or what to check for, to make it work.
If I put it after the add_item function, (where the include function currently is) the cart page displays, but with zero items in the cart. But if you go back to the menu page & click on the cart button, which calls the show_cart function, the items are in the cart.
Thanks in advance for any help or suggestions.