Hi,
I see two things that may be causing your problems:
1) You are not using the isset() function to test if the POST values have been set
2) You define a function, but you are not calling it. So, either call the function, or move the code outside a function definition...
<?php
//define variable $score
$score = '0';
//set up an array for the answer 'types'
$type = array();
// add values, if they exist
if(isset($_POST['registeredcharity'])) { $type[1] = $_POST['registeredcharity']; }
if(isset($_POST['incorporated'])) { $type[2] = $_POST['incorporated']; }
if(isset($_POST['regionalassociation'])) { $type[3] = $_POST['regionalassociation']; }
if(isset($_POST['regionalcharity'])) { $type[4] = $_POST['regionalcharity']; }
if(isset($_POST['project'])) { $type[5] = $_POST['project']; }
//score each type chosen 5 points
foreach($type as $key=>$value)
{
if($value >= "1")
{
$score = $score + 5;
}
else
{
$score = $score + 0;
}
}
// Print the number of points:
echo 'You have scored <strong>'. $score . '</strong> points!';
?>
Also, as a side note, "types" is not a very good name for your user-defined function. Function names should be descriptive, as yours is, surely, but they should also contain a present tense verb that describes the action or result of running that particular function. So, a function name "getScoreByType()" or "incrementScoreByType()" are a little longer, but make more sense when looking at your code several months from now, especially if your function is included in a separate file.... Just a thought. Hope that helps.