Using wpdb-insert correctly in function

0

I'm trying to insert data from the form created by pluguin Contact Form 7 to my table 'wp_wpdatatable_2', I created a hook using add_action and all right, but it does not send to the bank and I do not receive the success message (infinite loop when trying send), any advice?

Edited:

function wpcf7_do_something ($WPCF7_ContactForm) {
    global $wpdb;
    WPCF7_Submission::get_instance();   
    $numbene = $WPCF7_ContactForm->posted_data["NumerodoContrato"];
    $especie = $WPCF7_ContactForm->posted_data["Especie"];
    $descontm = $WPCF7_ContactForm->posted_data["DescontoMensal"];
    $nome = $WPCF7_ContactForm->posted_data["nome"];
    $file645 = $WPCF7_ContactForm->posted_data["file-645"];
    $file646 = $WPCF7_ContactForm->posted_data["file-646"];
    $file647 = $WPCF7_ContactForm->posted_data["file-647"];


    $wpdb->insert ('wp_wpdatatable_2', array(
        'NumerodoContrato' => $numbene,
        'especie' => $especie,
        'descontomensal' => $descontm,
        'nome' => $nome,
        'anexoidentidade' => $file645,
        'anexocomprovanteresidencia' => $file646,
        'anexodocumentoextra' => $file647


    ) );  


    }
add_action("wpcf7_before_send_mail", "wpcf7_do_something", 10, 1);
    
asked by anonymous 21.03.2018 / 19:14

0 answers