This code will perform an insert functionality to a table when a Contact form (WPDB7) is submitted.
In functions.php place this code.


add_action('wpcf7_before_send_mail','save_form');
function save_form( $wpcf7 ){
global $wpdb;
$submission = WPCF7_Submission::get_instance();//get form data
if ($submission){
$submited = array();
$submited['title'] = $wpcf7->title();
$submited['posted_data'] = $submission->get_posted_data(); //get submitted data
    }
if(!empty($submited)){
$current_uid = get_current_user_id();
$wpdb->insert( $wpdb->prefix.'events',//table name events
		    array( 
            'name'      =>$submited['posted_data']['your-name'], //identifier for name provided in wpcf7
            'email'     =>$submited['posted_data']['your-email'], //identifier for email provided in wpcf7
            'invoice'   =>$submited['posted_data']['invoice'], //identifier for invoice provided in wpcf7
             'uid'      =>$current_uid, 

            'timestamp' =>time(),			 
)
   );    
     }
}