Sorry, for beeing abit absence here.. I've had alot to do lately.
First the SQL is a one time activated part, it will setup two database tables within your database. It dosn't need to be part of any of your other code, if you have shell access to where you run your orderpage from, then you can put that in a fiel all by itself, and submit it to your MySQL like:
Quote:
|
> mysql -u "your user" -p "your database" < "file with sql code"
|
And it will be setup for you.
Next is to fill it with some usefull info, this is done by using something like:
Code:
INSERT INTO TABLE categories VALUES ('1', 'my first category');
INSERT INTO TABLE items VALUES ('1', '1', 'first item', 'this is first item within first category');
etc.
This can be submitted into yoru database like you did with the creation of the database-tables. Or it could be performed through some web interface where you'd submit it, or through some export function from some third party software, or how ever it will be formed....
Next onto the code snippits I've shown you, the first part is part of your order-page, it will go through every category in your database, selecting every item that has the appropriate category reference set, in short, it will build your order page to display everything you previusly filled into your database.
The second code-snippit is the part that is to be called when the user press submit in your order-form, this is the contence of your "action=blah.php" file setting in the <form> definition.
If you decide to view the source of my order-page, you will notice the javascript is slightly altered to handle the 2D array style of the checkboxes I'm using.
Now in my solution, I decided to just parse on the name of the items as the value to the checkboxes, but since you want to use additional information, like price, name, etc. in your billing to the consumer, you need to alter my orriginal database-tabel setup, and add a "price" container in the items table, aswell as parse the
id of the item as the value within the checkboxes in your order page.
However when I decided to show you the PHP code snippits, I had already taken that into calculation, so it will naturaly do just that.
I hope all of this somehow make sence...