You need to integrate your form and php form processor with Wordpress.
One method to do this in your theme as follows.
Create a page template in your theme folder, as described here. And put your form markup in it.
Don't specify an action
on your form, and add a hidden field to your form with arbitrary name and value. We will check against, and then look for that input to handle your form input,
For example:
<?php
/* Template Name: My Form
*/
?>
<form method="POST">
<input type="hidden" name="my_hidden_field" value="xyz">
....
</form>
Now create a page in WP Admin and assign above created template. Load this page in browser to display your form.
Next put this code in functions.php
of your theme
add_action( 'init', function() {
if ( empty( $_POST['my_hidden_field'] ) ) {
return;
}
// handle form submission
include "xxx_insert.php"; // Replace xxx_insert.php with exact path to php file
}
Other methods to achieve the result is writing a plugin or shortcode.
I hope this may helps!
/wp-content/themes/mytheme/xxx_insert.php