How to add custom form in moodle 2.0 and how to submit data to database
Re: How to add custom form in moodle 2.0 and how to submit data to database
http://docs.moodle.org/dev/lib/formslib.php_Form_Definition ; just include the class within the page you want the form
require_once("$CFG->libdir/formslib.php");
class simplehtml_form extends moodleform {
function definition() {
global $CFG;
$mform =& $this->_form; // Don't forget the underscore!
$mform->addElement()... // Add elements to your form
...
} // Close the function
} // Close the class
and then in the page add
$mform_simple = new simplehtml_form( null, array('email'=>$email, 'username'=>$username ) );
$mform_simple->display();
Re: How to add custom form in moodle 2.0 and how to submit data to database
Re: How to add custom form in moodle 2.0 and how to submit data to database
Hello,
This is something I am really interested in and I would like to know more.
The docs.moodle link given by jos cape looks a little intimidating and I also looked at the tutorial link at the bottom and it looks really helpful as a supplement to the docs.moodle page.
But I don't see where all of the information is sent to a database. I would guess I need to create a database in cPanel MySQL and then link the data from the form to the database.
Is there any other tutorials you can point a beginner to? I could handle making .php files with copy and paste ~ first I would like to make sure the information is linked to a database.