Treatment Matching Test
if (isset($_POST['submit'])) { // IF FORM HAS BEEN SUBMITTED
$problem = FALSE;
// QUESTION 1
if (isset($_POST['q1'])) { // Verify that user has selected an option for q1
$q1 = $_POST['q1'];
$q1 = $q1 * 2;
} else {
print 'ERROR: You must select an answer for Question 1. Please press your the back button in your browser and answer the question.
‘;
$problem = TRUE;
}
//QUESTION 2
if (isset($_POST['q2'])) {
$q2 = $_POST['q2'];
$q2 = $q2 * -2;
} else {
print ‘ERROR: You must select an answer for Question 2. Please press your the back button in your browser and answer the question.
‘;
$problem = TRUE;
}
// QUESTION 3
if (isset($_POST['q3'])) {
$q3 = $_POST['q3'];
$q3 = $q3 * 2;
} else {
print ‘ERROR: You must select an answer for Question 3. Please press your the back button in your browser and answer the question.
‘;
$problem = TRUE;
}
// QUESTION 4
if (isset($_POST['q4'])) {
$q4 = $_POST['q4'];
$q4 = $q4 * -1;
} else {
print ‘ERROR: You must select an answer for Question 4. Please press your the back button in your browser and answer the question.
‘;
$problem = TRUE;
}
// QUESTION 5
if (isset($_POST['q5'])) {
$q5 = $_POST['q5'];
$q5 = $q5 * 1;
} else {
print ‘ERROR: You must select an answer for Question 5. Please press your the back button in your browser and answer the question.
‘;
$problem = TRUE;
}
// QUESTION 6
if (isset($_POST['q6'])) {
$q6 = $_POST['q6'];
$q6 = $q6 * 2;
} else {
print ‘ERROR: You must select an answer for Question 6. Please press your the back button in your browser and answer the question.
‘;
$problem = TRUE;
}
// QUESTION 7
if (isset($_POST['q7'])) {
$q7 = $_POST['q7'];
$q7 = $q7 * -3;
} else {
print ‘ERROR: You must select an answer for Question 7. Please press your the back button in your browser and answer the question.
‘;
$problem = TRUE;
}
// QUESTION 8
if (isset($_POST['q8'])) {
$q8 = $_POST['q8'];
$q8 = $q8 * -2;
} else {
print ‘ERROR: You must select an answer for Question 8. Please press your the back button in your browser and answer the question.
‘;
$problem = TRUE;
}
// QUESTION 9
if (isset($_POST['q9'])) {
$q9 = $_POST['q9'];
$q9 = $q9 * 3;
} else {
print ‘ERROR: You must select an answer for Question 9. Please press your the back button in your browser and answer the question.
‘;
$problem = TRUE;
}
// QUESTION 10
if (isset($_POST['q10'])) {
$q10 = $_POST['q10'];
$q10 = $q10 * -1;
} else {
print ‘ERROR: You must select an answer for Question 10. Please press your the back button in your browser and answer the question.
‘;
$problem = TRUE;
}
// QUESTION 11
if (isset($_POST['q11'])) {
$q11 = $_POST['q11'];
$q11 = $q11 * 1;
} else {
print ‘ERROR: You must select an answer for Question 11. Please press your the back button in your browser and answer the question.
‘;
$problem = TRUE;
}
// QUESTION 12
if (isset($_POST['q12'])) {
$q12 = $_POST['q12'];
$q12 = $q12 * -1;
} else {
print ‘ERROR: You must select an answer for Question 12. Please press your the back button in your browser and answer the question.
‘;
$problem = TRUE;
}
// QUESTION 13
if (isset($_POST['q13'])) {
$q13 = $_POST['q13'];
$q13 = $q13 * 2;
} else {
print ‘ERROR: You must select an answer for Question 13. Please press your the back button in your browser and answer the question.
‘;
$problem = TRUE;
}
// QUESTION 14
if (isset($_POST['q14'])) {
$q14 = $_POST['q14'];
$q14 = $q14 * -1;
} else {
print ‘ERROR: You must select an answer for Question 14. Please press your the back button in your browser and answer the question.
‘;
$problem = TRUE;
}
// QUESTION 15
if (isset($_POST['q15'])) {
$q15 = $_POST['q15'];
$q15 = $q15 * -2;
} else {
print ‘ERROR: You must select an answer for Question 15. Please press your the back button in your browser and answer the question.
‘;
$problem = TRUE;
}
// QUESTION 16
if (isset($_POST['q16'])) {
$q16 = $_POST['q16'];
$q16 = $q16 * -1;
} else {
print ‘ERROR: You must select an answer for Question 16. Please press your the back button in your browser and answer the question.
‘;
$problem = TRUE;
}
// END OF QUESTIONS ARRAY
// PRINT TOTAL IF EVERYTHING HAS BEEN SELECTED
if ($problem == FALSE) {
$total = $q1 + $q2 + $q3 + $q4 + $q5 + $q6 + $q7 + $q8 + $q9 + $q10 + $q11 + $q12 + $q13 + $q14 + $q15 + $q16;
print “
Test Result:
Your Score: $total
“;
if ($total <= 0) { // if total is less than 0 or less than zero.
print "
Comment:Your results indicate that the 12 step program may be more beneficial to you.
If you would like to go back and take the test again click here otherwise to go back to the home page please click here.”;
} elseif ($total > 0) {
print “
Your results indicate our program may be more suitable for you than the 12 step program.
If you would like to go back and take the test again click here otherwise to go back to the home page please click here.”;
}
}
} else { //display form
echo ‘
Are you a good match for this program?
Instructions
To determine whether or not our course / program is a good fit for you, please answer the questions in the survey below.
Read each statement and indicate the extent to which you agree or disagree with that statement:
Begin Test Below:
‘; }
?>
- No categories



