I need to create a form that, when submitted, stores the form data in the WordPress database. I can create the functions to do this in the standard PHP/MySQL integration way, but I want to not have to re-enter the DBHost, Username, and Password. I understand that using $wpdb may be a good way to use the standard WordPress installation host, username, and password to communicate with the database. I tried several variations of this with no luck. I also need to be able to do this from a template file. Can anyone help with this?
In short what I need is
- WP to check if a certain database table of my naming exists
- To create it if it does not exist
- To store all form data in that database table every time the form is submitted
- To retrieve that data through a separate template file
- All using the information from the wp-config.php file without reentering it
I know that is a lot, but if anyone can help I would greatly appreciate it. Thank you!