Question: I need to create a simple shopping cart using PHP. The problem is, that I am not supposed to use a database for this. How
I need to create a simple shopping cart using PHP. The problem is, that I am not supposed to use a database for this. How do I create a shopping cart, including a receipt/order summary area, without a database? Need to offer 3 different products.
When the "Add to Shopping Cart" button is pressed, the selected/entered item and purchase quantity will be stored in PHP session/global variables as line items. Do not use database for storage. The button should be allowed to be pressed multiple times.
When the "Check Out" button is pressed, the stored line items will be retrieved, line item subtotal calculated, tax and grand total calculated, and the receipt will be displayed on the existing or new page.
Note that the receipt cannot be in a pop-up message box. It should include itemized product, quantity, unit price, subtotal, tax, and grand total amount.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
