On your update products page where I assume you will be using the MRT SB you would pass the product id using the id value returned in your recordset and then pass the value for categories from a select list, here is some code from a previous project that used this logic:
<?php
// WA DataAssist Manage Relational Table 1
if (isset($_POST["update_x"])) // Trigger
{
$WA_arrayOrFieldList = 0;
$WA_joinLoopedField = "assocCat";
$WA_loopedField = "";
$WA_connection = $connDB;
$WA_table = "lnk_product_category";
$WA_redirectURL = "view-product.php?prodID=".((isset($_POST["prodID"]))?$_POST["prodID"]:"") ."";
$WA_keepQueryString = false;
$WA_masterKeyField = "prodID";
$WA_masterKeyType = "none,none,NULL";
$WA_masterKeyValue = "".$row_rsProducts['prodID'] ."";
$WA_masterKeyComp = "=";
$WA_joinedKeyField = "catID";
$WA_joinedKeyType = "none,none,NULL";
$WA_joinedKeyComp = "=";
$WA_fieldNamesStr = "prodID|catID";
$WA_columnTypesStr = "none,none,NULL|none,none,NULL";
$WA_appliedString = "";
$WA_appliedList = array();
$WA_valuesList = array();
$WA_connectionDB = $database_connDB;
mysql_select_db($WA_connectionDB, $WA_connection);
if ($WA_arrayOrFieldList == 0) {
$WA_loopedValues = $_POST[$WA_joinLoopedField];
for ($v=0; $v<sizeof($WA_loopedValues); $v++) {
$WA_fieldValues = "^MASTERID^" . "|" . "^JOINID^";
$WA_valuesList[] = array($WA_loopedValues[$v], $WA_fieldValues);
$WA_appliedString .= "^" . $WA_loopedValues[$v] . "^";
$WA_appliedList[] = $WA_loopedValues[$v];
}
}
else if ($WA_arrayOrFieldList == 1) {
$WA_mrtLoopCounter = 0;
while (WA_AB_checkLoopedFieldsExist(array($WA_loopedField), $WA_mrtLoopCounter)) {
if (WA_AB_checkLoopedFieldsNotBlank(array($WA_joinLoopedField), $WA_mrtLoopCounter) && WA_AB_getLoopedFieldValue($WA_loopedField, $WA_mrtLoopCounter) == WA_AB_getLoopedFieldValue($WA_joinLoopedField, $WA_mrtLoopCounter)) {
$WA_fieldValues = "^MASTERID^" . "|" . "^JOINID^";
$WA_valuesList[] = array(WA_AB_getLoopedFieldValue($WA_loopedField, $WA_mrtLoopCounter), $WA_fieldValues);
$WA_appliedString .= "^" . WA_AB_getLoopedFieldValue($WA_loopedField, $WA_mrtLoopCounter) . "^";
$WA_appliedList[] = WA_AB_getLoopedFieldValue($WA_loopedField, $WA_mrtLoopCounter);
}
$WA_mrtLoopCounter++;
}
}
WA_AB_doManageRelationalTable($WA_valuesList, $WA_appliedString, $WA_appliedList, $WA_connection, $WA_table, $WA_masterKeyField, $WA_masterKeyType, $WA_masterKeyValue, $WA_masterKeyComp, $WA_joinedKeyField, $WA_joinedKeyType, $WA_joinedKeyComp, $WA_fieldNamesStr, $WA_columnTypesStr);
if ($WA_redirectURL != "") {
if ($WA_keepQueryString && $WA_redirectURL != "" && isset($_SERVER["QUERY_STRING"]) && $_SERVER["QUERY_STRING"] !== "" && sizeof($_POST) > 0) {
$WA_redirectURL .= ((strpos($WA_redirectURL, '?') === false)?"?":"&").$_SERVER["QUERY_STRING"];
}
header("Location: ".$WA_redirectURL);
}
}
?>
A couple of explanations might be in order
$WA_joinLoopedField = "assocCat"; is the select list containing the categories
$WA_table = "lnk_product_category"; is my database table set up like yours (see attached screenshot)
$WA_masterKeyValue = "".$row_rsProducts['prodID'] .""; is the product ID recordset value
you should be able to work out everything else from there.