Making a shopping website with php

PHP code. So I am making a shopping and cart feature in my website, but my Product.php file isn’t working. It doesn’t even show up with the customer logs in and goes to My Account because when the customer logs in it goes to their profile then they click on My Account to go to the Prodcut.php page where they can shop. But when I do that I get an error. When I did have it working the quantity of products starts with 1 when I would like for it to start with 0. When you click on add to cart, it doesn’t show up in the cart it says “cart is empty”. HELP!

MY CODE IS TOO LONG TO POST HERE go to my GitHub repository to see the code. GitHub CMS repo

The files I need help with are my Products.php and cart.php.

If you know of a better way to do a shopping code please share

First off, make sure the session is being properly managed. Add session_start() at the beginning of both files to ensure the session persists after login. Also, check that the link from “My Account” actually points to Product.php after the customer logs in.

For the quantity starting at 1, just change the default value in your quantity input field to 0, something like this:

CODE : <input type="number" name="quantity" value="0" min="0">

As for the cart being empty, double-check that the products are actually being added to the session or database. Make sure you’re storing them in $_SESSION['cart'][]. If none of that works, maybe consider using AJAX for better cart updates so it doesn’t reload the page every time. I’ve had similar issues before, and a PHP development agency would definitely recommend keeping sessions solid and ensuring SQL queries are right.