Note:

If you want to create a new page for developers, you should create it on the Moodle Developer Resource site.

Talk:lib/formslib.php Usage: Difference between revisions

From MoodleDocs
No edit summary
m (Text replacement - "</code>" to "</syntaxhighlight>")
Line 3: Line 3:
<code php>
<code php>
} else if ($fromform = $mform->get_data()) {
} else if ($fromform = $mform->get_data()) {
</code>
</syntaxhighlight>


What is '''$fromform''' and where is it defined?
What is '''$fromform''' and where is it defined?

Revision as of 20:06, 14 July 2021

The sample code on this page refers to $fromform:

} else if ($fromform = $mform->get_data()) { </syntaxhighlight>

What is $fromform and where is it defined?

Answer: It is defined inside the exact IF you quoted ("$fromform = $mform->get_data()") and it holds all the form's data from the form's page (in to which, the user just entered her/his preferences) Now, it is your responsibility to save it into the $DB