How to add custom form in moodle 2.0 and how to submit data to database

How to add custom form in moodle 2.0 and how to submit data to database

- Jyoti Kashid の投稿
返信数: 3

How to add custom form in moodle 2.0 and how to submit data to database 

Jyoti Kashid への返信

Re: How to add custom form in moodle 2.0 and how to submit data to database

- Joe Cape の投稿
画像 Plugin developers

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();
Joe Cape への返信

Re: How to add custom form in moodle 2.0 and how to submit data to database

- Dominick Inglese の投稿

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.