π Howdy!
I am trying to code a simple cart. Yes, there are free and pay-to-use carts available but I want to learn php.
I have been studying sessions and have a few questions to get me to the next level.
How does one make a button (like a press-here-to-order button) create a variable in a session?
I created a catalog page and on one side is a stack of buttons that can be pressed to order the items. A user, in theory, can press none to all the buttons and then proceed to a new catalog page with the same set-up. I have located code that sends the data to a php script, but not one that keeps the data within the session in progress on that very same page to be passed to the next pages. Any simple code snippets for me to study?
I do not have a clue how MySQL works and the server may not support it (Earthlink is not the best host to have but that is where my client is lodged). In fact, Earthlink requires all php scripts to use the file extension .php4 β which makes it an unhappy way to code if you are trying out a downloaded script.
Eventually, the visitor will press the check-out button and see the total list of items selected (inventory numbers, brief descriptions and prices). This page would allow them to delete an item, return to shop or fill out a form with their details. Therefore, a flat file may be in order (since MySQL may not be an option). How does one assign a number to match the client before they fill out a form β perhaps a session id? Or should one assign a number at the start of the first visitor encounter? My client does not want visitors signing in or filling out forms until after they made selections and try to check-out. Again, can I get some code for me to study?
The results of their selections and the form information would then be sent by email. I can get a form sent to an email without any problem. Obviously, if I create a flat file, then I need to be able to add that to the email somehow. Any code snippets for this? I hate arrays β just a personal thing β so I would prefer to have line breaks for data β is that possible with the flat file creation and read?
Anyway, thanks in advance,
Bill