Try the
print_r($_SESSION['answers']);
before you set to see how it looks.
This might help with the debugging.
SStedman
Junior Poster in Training
54 posts since Jun 2007
Reputation Points: 10
Solved Threads: 0
<?
//items is the checkbox
//$curr is a string created designating the question
$answers = $_POST['items'];
if (count($answers) > 0)
{
// Loop through the answers, and for each answer assign the value to $a
foreach($answers as $a):
// Then make an array within the answers and $curr array and store value of $a
$_SESSION['answers'][$curr][]=$a;
endforeach;
// Print_r to check array
print_r($_SESSION['answers']);
}
?>
That should work - I have not tested it, but it should loop through each value from the checkboxes and put it into the array like you want.
kroche
Junior Poster in Training
52 posts since Mar 2010
Reputation Points: 10
Solved Threads: 0