I'm not exactly sure where to post this - in html, php, or mysql area but since this is mostly php oriented, I figure I'll post it here for starters til I get yelled at ><
This is not for the general public, nor attached to any website, and tho it is online it will have only one user at any given time - with login/password so I'm not worried about how this is really implemented.
What I'm trying to do:
I'm trying to write a receipt generator. It works beautifully with only one item, however, my problems start with multiple items.
User is asked how many different items are being purchased.
A form is printed, with fields for item, quantity, description, and cost, so 4 fields total for every unique item.
Checks for already existing customer -
Updates mysql database with the 4 fields plus customer id, order id, and a datetime stamp - and in a seperate table adds the customer's name, phone number, and unique id for that customer
Updates mysql database with the 4 fields plus customer id, order id, and a datetime stamp and in the other table nothing is changed
Generates the total cost and the customer's name, phone number, and the information submitted from page 2, and prints out the receipt in a tasteful layout
The goal is to make this receipt generator as quick as possible, because time is of the essence. I could make a seperate form for every item on a seperate page or whatever for however many uniqe items are entered, and carry all the information from one page to another manually - but since the amount of items is undetermined it would take years to get up to 100,000 items and the amount of pages would be impractical, not to mention each page would get substantially larger since I have to keep adding the previous carried over variables.
What I would like to do:
After the user enters however many unique items are being sold the next page will display the 4 fields for each item (so if 3 unique items are being sold there will be 12 fields displayed - 3 sets of 4 fields) - with each set of 4 fields having some sort of unique identifier which carries onto the 3rd page and only having a single submit button to go to the next page that will process the information.
I know the best way to do this (at least logically to me) is to implement 4 arrays somehow, and then use 4 for loops to spit out the information into the database and into the receipt itself, or use 1 multi-dimensional array, but I haven't really played around with multi-dimensional arrays much.
I thought about doing it thru session handling, but I don't know where exactly I should do this, or if a user can even input information directly into a $_SESSION variable. I seriously doubt it can be done - at least legally - I also don't think it's possible to take a form submission of multiple fields - parse the fields and put the corresponding fields into the correct session array - like item0 goes into $_SESSION and so on...
So I'm kinda stumped here. If anyone has any ideas behind the logic of what I should do I am anxious to hear about it. I would include code but I dont think that this question warrants any, tho if you would like to see what I have I can post it.
Thank you for any help or suggestions.