Dear Frank,
If I can refer to my 'set_layout.php' from the prevous post, then the input data to the form is in the 'new', but to get the data out when the 'submit' button is pressed then you need to call 'get_data()', now for some reason and I do not know why, this needs to be done before the form is 'display()'ed as when you click on 'submit' it returns back to the code, in your case 'mystaff.php'. But my code looks like this:
$mform = new set_layout_form(null, array('courseid' => $courseid, 'setelement' => $setelement, 'setstructure' => $setstructure));
if ($mform->is_cancelled()) {
redirect($courseurl);
} else if ($formdata = $mform->get_data()) {
put_layout($formdata->id, $formdata->set_element, $formdata->set_structure);
redirect($courseurl);
}
echo $OUTPUT->header();
echo $OUTPUT->box_start('generalbox');
$mform->display();
echo $OUTPUT->box_end();
echo $OUTPUT->footer();
So the return value names of '$formdata->set_element' and '$formdata->set_structure' are the names defined when the elements were added in 'addElement' - which in my case is in 'set_layout_form.php' as:
$mform->addElement('select', 'set_element', get_string('setlayoutelements', 'format_topcoll'), $formcourselayoutelements);
and
$mform->addElement('select', 'set_structure', get_string('setlayoutstructure', 'format_topcoll'), $formcourselayoutstrutures);
where I defined 'set_element' and 'set_structure' and 'put_layout' is my function but is being passed in the values of the drop down. So if the form returns data then 'get_data()' will work and that will be a structure containing the element values you want.
I hope this makes sence, cheers,
Gareth