On the client side, a few functions need to be done as follows using Prototype. Of course, be sure that you include the prototype.js in between your <head></head> tags
On the page where the shopping cart is being displayed is a DIV that has the id “cartResult” as follows:
And on the server side, the managecart.php which does simple task, and being passed with two parameters, which the first one is the task which determines whether it shall add a new item to the cart or delete an item. And the second parameter is the item no that uniquely identifies each item that is stored in the database. And the items will be stored on the instance of cart.class.php, which items are stored in array and then being stored in PHP session.
And another PHP page, viewcart.php that shows the cart’s content, as follows: