It happens because you are declaring the function after trying to call it:
tally($_POST[$qvar]);// LINE THAT CAUSES ERROR
function tally ($question) // TALLY FUNCTION DECLARATION COMES LATER
I would put either before
if(isset($_POST['submit'])) {
or as the first thing inside.
if (!function_exists('tally')) {
function tally ($question) // TALLY FUNCTION
{
global $nowval;
$nowval[$question]++;
}
}
$this->tally won't work because it's not an Object, you are justing decrating a function.