Untested:
<?php
// SET AGES FROM Q10
$ageArray = array(
'a' => 'never',
'b' => 'under 10',
'c' => '10',
'd' => '11',
'e' => '12',
'f' => '13',
'g' => '14'
);
$age = (!empty($ageArray[$Q10])) ? $ageArray[$Q10] : 'a default or error value';
// EVALUATE IF Q10 Answer is A and Q11 is RED
if($Q10 == 'a' and ($Q11 == 'a' or $Q11 == 'b')) {
$msg = '1 RED You said that your child has never consumed alcohol, <b>but you are not sure of this</b>. This is the safest option for your child. Continue to encourage your child not to drink, until they are at least 18 years old.';
}
// EVALUATE IF Q10 Answer is A and Q11 is GREEN
elseif($Q10 == 'a' and ($Q11 == 'c' or $Q11 == 'd')){
$msg = '1 GREEN You said that your child has never consumed alcohol. This is the safest option for your child. Continue to encourage your child not to drink, until they are at least 18 years old.';
}
// EVALUATE IF Q10 Answer is e,f,g and Q11 is RED
elseif(($Q10 == 'e' or $Q10 == 'f' or $Q10 == 'g') and ($Q11 == 'a' or $Q11 == 'b')) {
$msg = '2 RED You said your child started drinking alcohol when they were '.$age.', <b>but you are not sure of this</b>. Research shows that children who begin drinking alcohol at this age are at higher risk of developing alcohol problems later in life. Later on we will suggest some things you can do to reduce your child’s risk of developing alcohol problems. ';
}
// EVALUATE IF Q10 Answer is e,f,g and Q11 is GREEN
elseif(($Q10 == 'e' or $Q10 == 'f' or $Q10 == 'g') and ($Q11 == 'c' or $Q11 == 'd')) {
$msg = '2 GREEN You said your child started drinking alcohol when they were '.$age.', Research shows that children who begin drinking alcohol at this age are at higher risk of developing alcohol problems later in life. Later on we will suggest some things you can do to reduce your child’s risk of developing alcohol problems.';
}
// EVALUATE IF Q10 Answer is b,c,d and Q11 is RED
elseif (($Q10 == 'b' or $Q10 == 'c' or $Q10 == 'c') and ($Q11 == 'a' or $Q11 == 'b')) {
$msg = '3 RED You said that your child started drinking alcohol when they were '.$age.', <b>but you are not sure of this</b>. Research shows that children who begin drinking alcohol at this age are at a much higher risk of developing alcohol problems later in life. Later on we will suggest some things you can do to reduce your child’s risk of developing alcohol problems. ';
}
// EVALUATE IF Q10 Answer is b,c,d and Q11 is GREEN
elseif (($Q10 == 'b' or $Q10 == 'c' or $Q10 == 'd') and ($Q11 == 'c' or $Q11 == 'd')) {
$msg = '3 GREEN You said that your child started drinking alcohol when they were '.$age.', Research shows that children who begin drinking alcohol at this age are at a much higher risk of developing alcohol problems later in life. Later on we will suggest some things you can do to reduce your child’s risk of developing alcohol problems.';
}
else {
$msg = 'no input';
}
echo $msg;
echo '<br>';
echo 'Q10= '.$Q10;
echo '<br>';
echo 'Q11= '.$Q11;
?>