Hallo,
I created a record set to get some nested rows to use them in a select with option groups.
// the recordset
<?php $categories = mysql_query("SELECT prodGroup, categorie FROM productdetails GROUP BY categorie ORDER BY prodGroup, categorie"); ?>
// and the select menu
<select name="categorie" id="categorie">
<?php while ($row_categs = mysql_fetch_assoc($categories)) {
$group = $row_categs['prodGroup'];
if ($last_group != $group) {
$last_group = $group;
echo "<optgroup label=\"".$row_categs['prodGroup']."\">\n";
}
echo "<option value=\"".$row_categs['categorie']."\"";
echo ($row_categs['categorie'] == $row_updateProduct['categorie']) ? " selected>" : ">";
echo $row_categs['categorie']."</option>\n";
} ?>
</select>
The problem is I can't add the end tag for the optgroup element.
Anyone an idea how to handle this?