I have a 2 tables one with 3 & the other with 4 columns🙁see prod_util & type_util below)
table:prod_util
| id | prd_grp | catgory |
| 1 | t1 | active |
| 2 | t2 | active |
| 2 | t2 | obsolete |
The catagory field is defined in another table, the prod_grp field is used in another table (type_util), where each value is matched to a catagory, I use a while loop to create a drop-down list when the user wants to add a new prd_grp (see code below).
The users first have to select a catagory to match it to & both values are inserted into the table (see the loop below).
So, you could add a new Prd_grp called "D5" & match it to any of the 2 catagories ONLY!
/*code--------while loop-----
while ($row = mysql_fetch_array($resulta)) {
$dgrp = $row["catagory"];
$option_gtype .= "<OPTION value = \"$dgrp\">$dgrp</OPTION>";
}
<!--later in the code-->
<select name=\"tcatagory\">
echo \"$option_gtype\";
</select>
---End code------*/
Question is, how do I create drop-down to add matching linked values to the table "type_util"? Where i have to track values in 2 columns. I thought about a 2 dimensional array???
I want to force the values of "prd_grp" & "catagory" to stay linked & insert them into the type_util table when the user adds a new "type".
I thought of inserting the record number of the record from the previous table, but that would complicate the code & make searches a beast with queries on queries.....
type_util
| id | type | prd_grp | catgory |
| 1 | led | t1 | active |
| 2 | led | t2 | active |
| 2 | led | t2 | obsolete |