There's a few ways you can go about this. Now, if I understand right, any key present in predminutes1 should also be present in predplayer1 (Or is that the other way around)? You could do the check within the first loop (suggested), or you could do it by stripping array keys later.
Within the first loop, using [man]array_key_exists[/man]:
# change first conditional to make sure both arrays are present
if(!empty($_POST['predminutes1']) && !empty($_POST['predplayer1'])) {
$count1 = 0;
foreach($_POST['predminutes1'] as $key1 => $gvalue1) {
$gsub1 = explode(' ', $gvalue1);
foreach($gsub1 as $gnumber1) {
if(!empty($gnumber1))
$count1++;
if($count1 > $predscore1)
eval(print_standard_error('error_invalidscorers1'));
# check here for key presence and error if it's not there
if(!array_key_exists($key1, $_POST['predplayer1']))
eval(print_standard_error('error_invalidpenalty1'));
}
}
}
Or, outside the loop using [man]array_keys[/man] and [man]array_diff[/man]:
if(!empty($_POST['predminutes1'])) {
$count1 = 0;
foreach($_POST['predminutes1'] as $key1 => $gvalue1) {
$gsub1 = explode(' ', $gvalue1);
foreach($gsub1 as $gnumber1) {
if(!empty($gnumber1))
$count1++;
if($count1 > $predscore1)
eval(print_standard_error('error_invalidscorers1'));
}
}
}
$keys1 = array_keys($_POST['predminutes1']);
$keys2 = array_keys($_POST['predplayer1']); # assuming you've checked to make sure this is present
$diff = array_diff($keys2, $keys1);
if(count($diff) > 0)
eval(print_standard_error('error_invalidpenalty1'));
The first way would probably be faster since you'd be doing the check within the original loop and saving work later on, but it checks that keys in predminutes1 are also present in predplayer1. The second way checks that keys in predplayer1 are in predminutes1.
(Sorry if this is confusing. It's early and my lack of coffee might make me hard to understand for a few hours)