A shopping cart is a program on a web server which allows users to select items from a "catalog" (a list of items on the website). It saves the list of what's ordered until checkout time, where the total cost is calculated and the user enters payment information.
In general, it uses a database, first for the information about the items, and second, for the list of what's been ordered. Beyond that, it may save user information, and so on. Session variables keep track of the users, so information is "remembered" from screen to screen and the program can handle simultaneous multiple users.
I've written shopping cart programs for classes, one in Perl, and one in ASP. I haven't done it in PHP, but it wouldn't be much different from the ASP version. Neither was "simple code," both took a couple weeks to program and involved several viewer screens besides the catalog. You're not going to get help on writing a project that size out of Yahoo Answers.
A shopping cart page is generated on the remote server, not on the local host (the user's machine.)
I hope this clears things up a little, at least so you'll understand what you need to do.