gosh, i tried that!
BUT... the key thing seems to be this.
i defined the variable $sel inside the if() statement, but I never really gave it an initial value, except there. So when I ran the edited code, all the options were highlighted except for the 1st option, but once i added $sel = ""; before the if() statement, it highlighted the correct options. I don't know why that fixed it, but i'll look into it later. 🙂
also, since i don't know what values $country is because i'm getting the data from the db, i did this instead to make the list an array.
$country = explode(",", $country);
so my complete code look like so:
$country = explode(",", $country);
$result = mysql_query("SELECT * FROM tblCountryList ORDER BY country_name",$dbServerConn);
while ($row = mysql_fetch_array($result)) {
$country_id = $row['country_id'];
$country_name = $row['country_name'];
$sel = "";
if (in_array($country_id, $country)){
$sel = " selected";
}
echo "<option value=\"$country_id\" $sel> $country_name | $country_id | $row</option>";
}
echo "</select>";
also thanks. it made me look at things a bit closer.
I knew i wasn't crazy!