General developer forum

How to store form data in Moodle database table?

Re: How to store form data in Moodle database table?
Core developersParticularly helpful MoodlersPlugin developers

Please re-read my initial message - field names must not include any capital letters. Use the XMLDB editor to create the DB table definition for your plugin, do not manually create the database table.

Unless your database table is now called 'mdl_mdl_end_journalcontent', you need to fix the call to $DB->insert_record() - you should not add the 'mdl_' prefix yourself, it is automatically added by $DB->insert_record() (but if your table has not been created through the XMLDB editor definitions, it might not be named with the prefix, so $DB->insert_record() won't work).

You also still need to address the use of $_POST in your code.

You have an undefined variable $Course in there as well - I assume you meant $COURSE, but that won't work unless you've called require_login($course) at the top of the code - providing details of which course the user is visiting the page as part of.

I note, from the error message, that you have not enabled Debugging either, as I suggested in my first post.

Average of ratings: -