PHP link where one option includes 3 values from the same table column
What I'm trying to do is set up a series of menu items for categories of merchandise (rugs), with subcategories for size. I've succeeded in making links where the user can choose ALL sizes within a category (by not specifying size as a parameter at all) and I've succeeded in making links where the user can choose a specific size within a specific category, but I'm not able to create links where the user can choose a specific size OR see ALL sizes.
Here's what I've got:
3 tables: products, categories & size
The size table has 2 columns - sizeName, and SizeID - the sizeID column is an integer and it links to products table
The categories table also has 2 columns - categoryName and categoryID - the categoryID column is also an integer which links with the product table
A menu with categories, and each category has a drop down menu where the viewer can choose a size.
Each size link has a parameter which includes the categoryID as well (in following example, all the sizes are within one category):
small - products.php?categoryID=8&sizeID=1
medium - products.php?categoryID=8&sizeID=2
large - products.php?categoryID=8&sizeID=3
On the receiving page (products.php) I created a recordset which looks like this (I'm looking at the recordset dialog box within Dreamweaver CS4):
SELECT price, `description`, categoryID, largeImage, smallImage, sizeID
FROM products
WHERE categoryID = colname AND sizeID = varSize
ORDER BY price ASC
the variables look like this:
Name: colname
type: Integer
default value: -1
Runtime value: $_GET['categoryID'}
Name: varSize
Type: Integer
Default value: 1
Runtime value: $_GET['sizeID']
(Dreamweaver created colname and I created varSize. I'm not really sure why the default values are as they are).
This works. But how do I create a link parameter for all three sizes? And how do I edit my recordset so it has a variable with all 3 sizes and how does that variable get written into the WHERE part of the code? Or, am I making this harder than it should be?
Any help would be greatly appreciated.
Thanks,
Dave
