Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
By ej on
Hi!
I want to make a form and save it's data in my own tables (custom tables) in drupal 7 database. how could I do that?
Thanks!
Comments
You need to create your own
You need to create your own module and create your tables in a .install file using hook_schema. Then, in your .module file, you can create your form which will save the values entered by the user to your tables in the form submit function. Take a look at hook_schema for more help. Also, the Form API page.
Shabana Navas
snavas@acromedia.com
Software Developer
Acro Media
https://www.acromedia.com
1-800-818-4564
Skype: super.shaba
Thanks:) You know, In fact
Thanks:)
You know, In fact it's not a form...
I want to make a documentation in my web site, and I want to develop it by users, these data may be entered in a basic page or my own content type, and then they will save on my own tables (custom tables). Could I do that?
Yeah, if you are going to
Yeah, if you are going to have your own module to install the new tables, then, I would go ahead and just add hook_node_insert() in the module file and save the data to the tables from there. Something like this:
Shabana Navas
snavas@acromedia.com
Software Developer
Acro Media
https://www.acromedia.com
1-800-818-4564
Skype: super.shaba
Recoverable fatal error...
test
Autonumber
Hi, and thanks for this.
To clarify and save someone time, if a field is is set to AUTO_INCREMENT in the database, just leave it out of the array and don't set it at all.