OK, I like the shorter version of the code, but I am lost. Remember, arrays is my handicap... Please let me see if I understand what you're saying.
Let's say I have an array for checkboxes $boxes (it'll be always the same). And another array $user_choice
$boxes = array('b1' => 'red', 'b2' => 'blue',' b3' => 'green');
$user_choice = array('c1' => 'red', 'c2' => 'green);
So now I need to build the list of checkboxes baser on $boxes and then check the ones corresponding to values containes in $user_choice. Now, once I have output it all in front of the user again, that user needs to make changes (if he wishes), i.e. select whatever her/she wants and save that selection in an array that will basically replace the array stored with $user_choice values.
Now here's where it gets hairy for me.
In my previous code I could do just that:
foreach ($boxes as $key => $value) {
echo "<input type='checkbox' name='$key' ";
if (in_array($key, $user_choice))
echo "checked='checked' ";
echo "/>$value\n";
}
I'm still sort of lost how to save submitted results into an array... I tried :
$new_array = array($_POST[$key']);
$new_user_choice = implode(",", $new_array);
Am I overcomplicating this issue again?..