Hi, I'm having problem with redirection from sub-plugin to plugin. What I want to do is this: if the form is canceled redirect and/or if the data is entered in the form redirect as well. Somehow I keep getting this error no mater what I do
Error code: missingparam
- line 463 of /lib/setuplib.php: moodle_exception thrown
- line 545 of /lib/moodlelib.php: call to print_error()
- line 30 of /mod/book/tool/validator/bcindex.php: call to required_param()
this is line 30 code:
$chapterid = required_param('chapterid', PARAM_INT);
And the lines in which I'm using redirection:
if ($mform->is_cancelled()) {
if (empty($chapterid)) {
redirect($CFG->wwwroot . "/mod/book/view.php?id=$cm->id");
} else {
redirect($CFG->wwwroot . "/mod/book/view.php?id=$cm->id&chapterid=$chapterid");
}
} else if ($data = $mform->get_data()) {
...
...
redirect($CFG->wwwroot . "/mod/book/view.php?id=$cm->id&chapterid=$chapterid");
... }
Can anyone suggest me what am I doing wrong here?