Redirect depending on checkbox selected

Home Forums Quform WordPress Redirect depending on checkbox selected

This topic is: not resolved
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #12255
    Kranzy
    Participant

    Hi,

    I am wanting to redirect to certain pages depending on the results of the submitted form.

    For the most part it is working, however I cannot seem to get it to work with my checkboxes.

    What is the correct syntax to check if the option ‘None of the above’ is selected?

    This is what i have so far…


    <?php
    function mytheme_conditional_form_redirect($url, $form)
    {
    $selectionQ3 = $form->getValue('iphorm_1_3'); //multiple choice
    $selectionQ5 = $form->getValue('iphorm_1_5'); //multiple choice
    $selectionQ6 = $form->getValue('iphorm_1_6'); //multiple choice
    $selectionQ9 = $form->getValue('iphorm_1_9'); //multiple choice
    $selectionQ10 = $form->getValue('iphorm_1_10'); //multiple choice
    $selectionQ11 = $form->getValue('iphorm_1_11'); //multiple choice
    $selectionQ12 = $form->getValue('iphorm_1_12'); //checkboxes
    $selectionQ12b = $form->getValue('iphorm_1_14'); // checkboxes

    if($selectionQ5 || $selectionQ6 == 'Yes'){
    $url = 'http://address.com.au/results_a';
    }
    elseif($selectionQ9 == 'Yes'){
    $url = 'http://address.com.au/results_b';
    }
    elseif(($selectionQ10 == 'No') && ($selectionQ12 == 'None of the above')){
    $url = 'http://address.com.au/results_c';
    }
    elseif($selectionQ10 == 'Yes'){
    $url = 'http://address.com.au/results_d';
    }
    elseif($selectionQ12 || $selectionQ12b != 'None of the above'){
    $url = 'http://address.com.au/results_e';
    }
    elseif($selectionQ3 == 'Yes' && $selectionQ12 == 'None of the above'){
    $url = 'http://address.com.au/results_f';
    }
    else{
    $url = 'http://address.com.au/';
    }

    return $url;

    }
    add_action('iphorm_success_redirect_url_1', 'mytheme_conditional_form_redirect', 10, 2);

    ?>

    #12264
    Ally
    Support Staff

    You don't have permission to view this content. Please log in or register and then verify your purchases to gain access.

    • This reply was modified 9 years, 8 months ago by Ally.
Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.
Be inspired. © 2024 ThemeCatcher Ltd. 20-22 Wenlock Road, London, England, N1 7GU | Company No. 08120384 | Built with React | Privacy Policy