Hi I am struggling to pin down a bug in one of my forms.
It throws this "Parameter missing " error:
When I check the stack trace I can see line 156 is part of an if else statement. I see no issue with the code itself :
if ($id) {
if (! $cm = get_coursemodule_from_id('tutorship', $id, 0, false, MUST_EXIST)) {
print_error('invalidcoursemodule');
}
if (! $course = $DB->get_record('course', array('id' => $cm->course), '*', MUST_EXIST)) {
print_error('coursemisconf');
}
if (! $tutorship = $DB->get_record('tutorship', array('id' => $cm->instance), '*', MUST_EXIST)) {
print_error('invalidcoursemodule');
}
} else if ($t) {
if (! $tutorship = $DB->get_record('tutorship', array('id' => $t), '*', MUST_EXIST)) {
print_error('invalidcoursemodule');
}
if (! $course = $DB->get_record('course', array('id' => $tutorship->course), '*', MUST_EXIST)) {
print_error('coursemisconf');
}
if (! $cm = get_coursemodule_from_instance('tutorship', $tutorship->id, $course->id, false, MUST_EXIST)) {
print_error('invalidcoursemodule');
}
} else {
print_error('missingparameter');
}
Can anyone shed some more light on this issue. Not sure why it is dropping to the else as the other parts seem ok.