简体   繁体   中英

How to save contact form's content to wordpress database and access in dashboard?

What would be the easiest way to create a contact form that saves the answer to a prize game's question to the wordpress database?

I already tried the combination of the two plugins "contact form" and "contact form to database" but customisation is only possible in the premium version.

Are there any existing plugins that could do what I need? If not, how to create something that could do it?

I guess I would have to create an options page in functions.php of the theme:

  • register "prize game" to menu
  • create a new table in the database
  • start a query for all posted answers that displays the answers etc.

Then I would need a contact form plugin:

  • create shortcode
  • create form
  • create query that checks if name or email address already exists in database
  • a function that checks if(isset $_POST[...]) and saves the post to the database with wp->insert

Am I right? Or is there an easier way to solve that problem?

I would appreciate some tips, links or code snippets. :)

Use Contact Form 7 and the Contact Form DB plugins.

CF7 is a great and easy to use email form generator plugin, and CFDB is an extension for it that allows you to not only save the form submissions to the database, but view them in the admin panel. You can also export the collected form submission data as XLS, CSV and so forth.

For more advanced functionality, CF7 also provides a lot of PHP hooks/filters you can use to manipulate data before, during and after form submission - check the CF7 Docs for details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM