Forum Moderators: coopster
<?php
//Below takes care of turning string into array.
$str = "option1,option2,option3";
$optionsArray = explode(',',$str);
//Turn array to HTML output
$numOptions = (5);
for ($i=0;$i<$numOptions;$i++)
{
if (array_search("option".($i+1),$optionsArray)===false) { $checked = ''; }
else { $checked = ' checked'; }
echo "<input type=\"checkbox\" name=\"options\"{$checked}>";
}
?>