重定向条件

I use a contact form 7 wordpress and I want as check boxes form the visitor is redirected to another page, but the code I'm trying is not working, especially the part 'foreach', you see the problem I have?

My code :

<?php
function wpcf7_do_something (&$WPCF7_ContactForm) {
    // Détection du titre du formulaire pour ne traiter que le bon au cas où il y en a plusieurs
    $title=$WPCF7_ContactForm->title;
    //compteur de minutes
    $cpt=0;

    if ($title=='pvh_guide'){
        $cpt=20; // test ok
        //foreach($WPCF7_ContactForm->services as $chkbx){
            //if ($chkbx=='10') $cpt+=10; // si on a coché la case 1, 2 ou 3 on ajoute 10 minutes au compteur
            //if ($chkbx=='20') $cpt+=10;
            //if ($chkbx=='30') $cpt+=10;
        //}
        // ensuite selon le comptage des minutes, on envoi sur une page avec une offre
        if ($cpt==10) $WPCF7_ContactForm->additional_settings = "on_sent_ok: \"location.replace('http://locationcontainernamur.com/offre1');\"";
        if ($cpt==20) $WPCF7_ContactForm->additional_settings = "on_sent_ok: \"location.replace('http://locationcontainernamur.com/offre2');\"";
        if ($cpt==30) $WPCF7_ContactForm->additional_settings = "on_sent_ok: \"location.replace('http://locationcontainernamur.com/offre3');\"";
        //$WPCF7_ContactForm->additional_settings = "on_sent_ok: \"location.replace('http://google.com/');\"";
    }
}
add_action("wpcf7_before_send_mail", "wpcf7_do_something");
?>
on_sent_ok: "var Iso = $("input[name=radio-565]:checked").val() ; if(Iso == 'value1' ){ location = 'www.bdparty24.com'; } if(Iso == 'value2' ){ location = 'www.bdstore24.com'; }"