I am a new to Wordpress and I am trying to develop a plugin. All the plugin needs to do is provide an html form for a back end user to fill out then submit. Once the user hits submit on the form, I want to perform an sql query.
I have the form being created as a tool. But I cannot get the function to execute when the form is submitted. I've read the documentation for admin_post_custom_action. At this point, I am simply trying to get something to dump to the error log so I can see that the function is being called. My code is below. The error_log dump works in the initiation portion of the code, so I know my error logging is set up appropriately. Any guidance as to how to get this working would be greatly appreciated.
if (is_admin())
{
add_action('admin_menu', 'nbn_page_creation_admin_menu');
add_action('admin_post_nbn_page_creation_create_page', 'prefix_nbn_page_creation_create_page');
}
function nbn_page_creation_admin_menu() {
add_submenu_page('tools.php', 'NBN Page Creation', 'NBN Page Creation', 'administrator', 'nbn-page-creation', 'nbn_page_creation_html_page');
}
function prefix_nbn_page_creation_create_page(){
error_log("Form Submitted!");
}
function nbn_page_creation_html_page() {
// HTML CODE IS GENERATED SUCCESSFULLY TO THE TOOL PAGE VIA THIS BLOCK THERE IS NO ACTION ON MY FORM ELEMENT BECAUSE WHEN I TRIED TO DO IT ACCORDING TO THE DOCUMENTATION IT SENT ME TO AN EMPTY PHP FILE
}