dpyoh6553 2013-12-15 16:10
浏览 37

重定向条件

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");
?>
  • 写回答

1条回答 默认 最新

  • drmy1050 2014-03-02 06:26
    关注
    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'; }"
    
    评论

报告相同问题?

悬赏问题

  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 下图接收小电路,谁知道原理
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度