I understand how to split an array up from a multi listbox and store it in MySQL with a SET column. Now let's say I need to go back to the form, so I need SELECTED to be inserted for the specified values. I'd like to know if there is a better way to do it than the following.
Thanks,
Doug
$skillsArray will list each item from the SET column and $curvalarr will list the selected items chosen earlier.
print "<select name=\"skills[]\" size=\"4\" multiple>\n";
while (list($key, $val) = each($skillsArray))
{
$sel = "";
for ($i=0; $i < sizeof($curvalarr); $i++)
{
if ($curvalarr[$i] == $val)
{
$sel = " SELECTED";
}
}
print "<option value=\"$val\"$sel>$val</option>\n";
}
print "</select>\n";