How to insert a short code into Contact Form 7 in WordPress that will call a function once the submit button is pressed

You can achieve it by changing the action of the particular form and then use the function to store the data in the database into a new file.

add_filter('wpcf7_form_action_url', 'wpcf7_custom_form_action_url');
function wpcf7_custom_form_action_url($url)
    global $post;
    $id_to_change = 1;
    if($post->ID === $id_to_change)
        return 'wheretopost.asp';
        return $url;