I want to create a button in moodle which redirects the user to the next topic so the topic's URL can change according to activity.
I don't know to do it I have tried using the below code.
$output .= html_writer::div("<a class='mod_quiz-next-nav' href='$url'>Goto Next Session</a>");
// redirect('https://web.whatsapp.com/');
$output .= html_writer::link($url, get_string('finishreview', 'quiz'),
array('class' => 'mod_quiz-next-nav'));
return $output;
please suggest to me how to set a button which URL can change dynamically.