Dynamic Form Menu
Hello,
I'm trying to put a dynamic form menu within a repeating section, in order to give the option to choose sizes. The sizes vary for each individual item (they change from item to item) and I'm having trouble setting up my recordset and menu to show the appropriate choices. I have 3 tables - an item table, an option table with the sizes, and an intermediate itemoption table linking the two tables. I want this information to be passed to ecart.
This is how I set up the recordset (which I suspect is wrong):
$varItem_rsSizes = "1";
if (isset($_GET['ItemID'])) {
$varItem_rsSizes = $_GET['ItemID'];
}
mysql_select_db($database_connSpectrum, $connSpectrum);
$query_rsSizes = sprintf("SELECT items.ItemID, options.OptionID, options.Option, options.OptionPrice, options.OptionWeight FROM items LEFT OUTER JOIN itemoptions ON items.ItemID = itemoptions.ItemID INNER JOIN options ON itemoptions.OptionID = options.OptionID WHERE items.ItemID = %s", GetSQLValueString($varItem_rsSizes, "int"));
$rsSizes = mysql_query($query_rsSizes, $connSpectrum) or die(mysql_error());
$row_rsSizes = mysql_fetch_assoc($rsSizes);
$totalRows_rsSizes = mysql_num_rows($rsSizes);
?>
And this is the form:
<form id="form1" name="form1" method="post" action="">
<label for="sizes">Sizes & Prices:</label>
<select name="sizes" id="sizes">
<option value="null" <?php if (!(strcmp("null", $row_rsItems['ItemID']))) {echo "selected=\"selected\"";} ?>>--Please select a size--</option>
<?php
do {
?>
<option value="<?php echo $row_rsSizes['OptionID']?>"<?php if (!(strcmp($row_rsSizes['OptionID'], $row_rsItems['ItemID']))) {echo "selected=\"selected\"";} ?>><?php echo $row_rsSizes['Option']?></option>
<?php
} while ($row_rsSizes = mysql_fetch_assoc($rsSizes));
$rows = mysql_num_rows($rsSizes);
if($rows > 0) {
mysql_data_seek($rsSizes, 0);
$row_rsSizes = mysql_fetch_assoc($rsSizes);
}
?>
</select>
</form>
Can anyone tell me how to fix this from within Dreamweaver's interface?
Thanks!