As a cheatsheet, you can watch my
page source, but I'd much rather talk you through it..
Naturaly I've let the connect/select of the database out of the file, for security reasons.
- The server in question here, is the one you're quering through your mysql_connect() call, when you want to fetch anything from your database.
That can be several if thats the case, you might have a test server and a public server, then you'll use it on the test server untill you want to go live with it.
- For ease, I'll tell what each codeline does in your displayed code-snippits.
- Just a comment to keep my thoughts straight through it all
- Select every info stored in the categories table of the database
- For as long as I can fetch a category row from the collected info
- set an internal variable so we know we've began, and therefor can balance the <td></td> to create a purdi view of it all
- Build the body of the HTML page, holding the category in question, and the checkAll() selection for that category
- Start the table which will hold the items found in current category
- Select any item that matches the category we have at hand
- For as long as we have an item, fill in the body of the table to reflect it, keeping in mind only to show two items valigned, here the $item_count comes in handy
- Second portion of your code-snippits explained
- Select every category contained within the categories-table
- Get an array of the checked selections on the order page
- For as long as theres a category in our stored categories info
- Go through every selected item from the order page
- Select every item from the items-table that matches the selected checkbox from the order page
- For as long as theres any info fetched from the match
- Build the body of the page, to display the selected items.
Quote:
|
I have tried putting this after the head and the body of the Order page (page with tables and checkboxes) seperately and it doesn't seem to produce the desired result. Parts of the code end up showing up on the page.
|
This is PHP code, it should be kept within correct PHP-tags, so teh server knows to call the PHP-engine to parse it through befor showing it to the viewer.
For PHP3
PHP Code:
<!-- start PHP-tag --><?php
/* all the code here */
?> <!-- End PHP-tag -->
For PHP4+
PHP Code:
<!-- start PHP-tag --><?
/* all the code here */
?> <!-- End PHP-tag -->
Quote:
|
And where exactly does this go?
|
The first portion goes to build the order page, the second portion goes to build the result page.
Quote:
|
would you rather continue this via email or keep it to this thread?
|
Given the fact, that this will bennefit from others chipping in, I would like to keep it in a thread like this, but if it turnes into something which is based on exchanging private information, then it would be more appropriate to switch to mail exchange.