How can I insert the data entered into the form in WordPress site to the MySQL database? I have created a form in the site. I am able to run PHP codes using snippets but I don't know how to update the database table from the values entered into the form in the WordPress site.

1 Answer 1


Basically, i use Contact Form 7 and it's third party extension for storing values in database i.e.: https://wordpress.org/plugins/contact-form-cfdb7/.

Or, if you want to create a custom form and store the value in database you can Create a Custom Post Type and use wp_insert_post() function to insert your respective values.

  • I wanted to save the values in the form to my user-defined table in db. How can I do that?
    – Sidharth K
    Jan 4, 2019 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.