1ページに1回以上同じIDを使用しないでください。
そして、value属性を'
で囲みます
<?php
foreach ($values as $value) {
$selected = in_array($value, $db_values) ? ' checked="checked"' : null;
echo "<input type='checkbox' name='sports[]' id ='sport' value='" . $value ."' " . $selected . "/>" . $value . "<br />";
} ?>
このようなアレイを作成する
$arr['F'] = "Football";
$arr['R'] = "Rugby";
$arr['C'] = "Cricket";
$arr[$value] instead of $value
編集
<?php
$arr['F'] = "Football";
$arr['R'] = "Rugby";
$arr['C'] = "Cricket";
foreach ($values as $value) {
$selected = in_array($value, $db_values) ? ' checked="checked"' : null;
echo "<input type='checkbox' name='sports[]' id ='sport' value=" . $value . $selected . "/>" . $arr[$value] . "<br />";
}
?>