Requirements
You should know what a session is. If you don't know, here's a quick outline. There are a lot of articles on this topic that you can find all the code examples you need. Open a session on your start page, using $#@60; Php
Session_Start ();
? $#@62;
This will create a session name and a session ID. You can now either pass the session ID through a form using the default cookie-based settings session, or use it as a variable attached to your link (get method). Don't forget to release the session at the end. :)
Your product should have a name, price and unique identifier so that it can be used in this example, if not, you may need to make a little change. Here I use MySQL as the backend to build pages and others, which is not necessary in order for the shopping to work. :)
You should understand the array. Now if someone has time to take advantage of my code and create a class of it, I should be thankful to get it.
Defined
To simplify this example, I used four separate arrays and some extra variables. The code can be optimized. This makes it easy to display ideas and read code. You can use the class to do better, but I'm not quite sure if I can save the object to the session. Does anyone want to comment on this?
We also need a project counter. Of course you can use the count () command, I just think it's good enough to always know how many projects there are, and it also provides a good counter for loops.
Job
Let's assume that you have a list of items in your HTML page
ID Name Price
1 Mouse 25.00 Add
2 Key 100.00 Add
3 Car 5000.00 Add
4 Game 25.00 Add
http://www.bkjia.com/PHPjc/531753.html www.bkjia.com true http://www.bkjia.com/PHPjc/531753.html techarticle ask you to know what the session is. If you don't know, here's a quick outline. There are a lot of articles on this topic that you can find all the code examples you need ...