Nooby question but when I try and get this to work (it should identify which
rows in the database have GK, MID, DEF, FWD against them and then put
SELECTED into the option value to give a default of what the entry is
currently) it just adds SELECTED to all the results as if $row["Position"]
is returning true against all four conditions? What am I doing wrong?
Thanks,
O.
while ($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
echo("<td>" . $row["Surname"] . "</td>");
echo("<td>" . $row["TeamName"] . "</td>");
?>
<td><select name="select2">
<option value="GK"<? if ($row["Position"] = "GK") {?>SELECTED<?}
?>>GK</option>
<option value="DEF"<? if ($row["Position"] = "DEF") {?>SELECTED<?}
?>>DEF</option>
<option value="MID"<? if ($row["Position"] = "MID") {?>SELECTED<?}
?>>MID</option>
<option value="FWD"<? if ($row["Position"] = "FWD") {?>SELECTED<?}
?>>FWD</option>
?>>
</select></td>
<?
echo("<td>" . $row["Selected"] . "</td>");
}