I have a series of questions that are multiple choice. Some of the questions have multiple answers to them.
Those questions have answers that are indicated by a checkbox that is named something like; Q4_1 Q4_2 etc... Of those, each one of the checkboxes that indicate a correct answer is given a point value. I need only get the total points of question 4 and not the individual checkbox scores. What I have; foreach($_POST as $key => $value){ if($key != 'Submit'){ if($key == ereg("^Q4_.[0-9]$", $key)){ $Q4score[$i] = $value; } print $key.": ".$value."<br>"; $Score[$i] = $value; } $i++; } print 'Q4: '.array_sum($Q4score); - Returns 0 print 'Total: '.array_sum($Score); - Returns correctly Is my ereg() wrong? My understanding is ereg("^Q4_.[0-9]$", $key) should look for a $key starting with 'Q4_' followed by a single number and place those values into an array named $Q4scores. What am I missing? Thanks, alex hogan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php