$result = mysql_query("SELECT aw,awardsid,name,url FROM award"); while ($award = mysql_fetch_array($result)) { if ($award['aw']!='') $checked='checked'; else $checked=''; echo "<tr> <td> <input type=\"checkbox\" name=\"aw[$award[awardsid]]\" value=\"$award[awardsid]\" $checked> $award[name] </td> <td nowrap> <img src=\"$award[url]\"> </td> </tr>"; }