however each product is part of a category. For example product = red trousers category - trousers.
each product comes in a variety of sizes.
when you land on the description page you have the product ID of the item you selected on the first page
but you can select all the products from the category from a dropdown menu then submit this and this returns to the same page and gives you the value of the new selected product.
this is all working so far but i have some code for the product size menu so that when the product is selected is calls the sizes for this product.
below is the code from the menu
Code: Select all
<select name="os0" class="text" id="selectSize">
<option value="Select Size">Select Size</option>
<?php
$query2 = sprintf("
SELECT DISTINCT
stock.StockID, size.Size
FROM
beauSS13_products AS prod
LEFT JOIN beauSS13_Stock AS stock ON prod.ID = stock.ID
LEFT JOIN beauSS13_SizeList AS size ON stock.SizeID = size.SizeID
WHERE
prod.ID = '%s' AND stock.Stock > 0
ORDER BY
size.SizeID ASC", GetSQLValueString($var1_Recordset1, "int"));
$results2 = mysql_query($query2);
while($row2 = mysql_fetch_array($results2)){
?>
<option value="<?php echo $row2['Size']; ?>"><?php echo $row2['Size']; ?></option>
<?php
}
?>
</select>this is also the other relevant code
Code: Select all
$var1_Recordset1 = "-1";
if (isset($_GET['ID'])) {
$var1_Recordset1 = $_GET['ID'];
}
mysql_select_db($database_beau, $beau);
$query_Recordset1 = sprintf("SELECT * FROM beauSS13_products, beauSS13_Stock, beauSS13_SizeList WHERE beauSS13_products.ProductID = %s AND beauSS13_Stock.SizeID = beauSS13_SizeList.SizeID", GetSQLValueString($var1_Recordset1, "int"));
$Recordset1 = mysql_query($query_Recordset1, $beau) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
i think it will be easier if i understand what is going on with
Code: Select all
<select name="os0" class="text" id="selectSize">
<option value="Select Size">Select Size</option>
<?php
$query2 = sprintf("
SELECT DISTINCT
stock.StockID, size.Size
FROM
beauSS13_products AS prod
LEFT JOIN beauSS13_Stock AS stock ON prod.ID = stock.ID
LEFT JOIN beauSS13_SizeList AS size ON stock.SizeID = size.SizeID
WHERE
prod.ID = '%s' AND stock.Stock > 0
ORDER BY
size.SizeID ASC", GetSQLValueString($var1_Recordset1, "int"));
$results2 = mysql_query($query2);
while($row2 = mysql_fetch_array($results2)){
?>
<option value="<?php echo $row2['Size']; ?>"><?php echo $row2['Size']; ?></option>
<?php
}
?>
</select>