Public feed
#890778
$states = ...
// states array of states with $states[0]['code'] = code of state $states[1]['name'];
// $selected_states is column that contains command separated list of states that are selection
$selected_states = split(',', $selected_states);
in html:
foreach ($states as $s): {
echo "<input type='checkbox' name='states[]' value='{$s['code']}'";
if (array_search($s['code'], $selected_states) !== false) {
echo ' checked="checked"';
}
echo '> ' . $s['title'] . '<br>';
}
when posting back:
$selected_states = join(',', $_POST['states']); // Gives you a value you can store in your DB
hope this helps.